In this first post i will be discussing about simply writing user infromation into a database.
Create a Mysql table which will contain all the login information of the user.
| Coloum | data type |
|---|---|
| userid | varchar(12) |
| password | varchar(12) |
| varchar(12) |
step2: Create form for the users to register.
<form action="insert.php" method="post">Username : <input type="text" name="userid" ><br>Password : <input type="password" name="password" ><br>E-mail: <input type="text" name="email" ><br><input type="submit" value="submit" name="submit"></form>
when user submit's this form it will go to insert.php
insert.php
this php code will insert value into the databse.
<?php$conn = mysql_connect("localhost","Database username","database password");//let us assume a database named login$db = mysql_select_db("login");// the values entered in the form are stored in variables$userid = $_POST["userid"];$password = $_POST["password"];$email = $_POST["email"];$result = mysql_query("insert into users(userid,password,email)"."values('$userid','$password','$email')");echo "thanks for registering your account with us";?>
Now the details of user is added into the database.
Please check out the next post to see the main part of login using session.
1 comments
