Lets assume you want to create a simple
registration form with like first name, last name, email and
password. Here visitor will fill-up the simple registration form
then verify their email address and eligible to login.
HTML Code to Create Registration Form:
<form method="POST" name="register" id="register" action="?register=true">
<label>First Name</label> <input type="text" name="fname" size="20">
<label>Last Name</label> <input type="text" name="lname" size="20">
<label>Email</label> <input type="text" name="email" size="20">
<label>Password</label> <input type="password" name="password" size="20">
<label>Captcha</label> <input type="text" name="captcha" size="20">
<img src="captcha.php" />
<input type="submit" value="Submit" name="submit">
</form>
You can either use
HTML 5 form field validation or
jQuery form field validation . Also use captcha to prevent spam. You can use
custom captcha or
re-captcha provided by Google.
Create MySQL Table :
Lets create our mysql table to store data from registration form.
CREATE TABLE `register` (
`userid` int(11) NOT NULL auto_increment,
`fname` varchar(50) NOT NULL,
`lname` varchar(50) NOT NULL,
`email` varchar(50) NOT NULL,
`password` varchar(100) NOT NULL,
`status` varchar(10) NOT NULL,
PRIMARY KEY (`userid`),
UNIQUE KEY `userid` (`userid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;
Create DataBase Connection Through PHP :
<?php
$host="localhost";
$uname="root";
$pass="";
$database = "a2zwebhelp";
$connection=mysql_connect($host,$uname,$pass) or
die("Database Connection Failed");
$selectdb=mysql_select_db($database) or
die("Database could not be selected");
$result=mysql_select_db($database) or
die("database cannot be selected");
@session_start();
set_time_limit(0);
?>
For better practice create a file called connection.php and include the file in all PHP pages.
<?php
include("includes/connection.php");
?>
Other Login/ Registration Systemss
Login/ Register With Twitter
Login/ Register With Linked In
Login/ Register With Yahoo!
Login/ Register With Gmail
Login/ Register With Hotmail
Login/ Register With Email