Login/ Register With Email

social media

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

Comments
14 February
2014
ctel
nice
13 February
2014
Mukesh Kumar
How do i connect the mysql data base connectivity to any php form.
Please i should be code, please urgent sir....
06 February
2014
annie
I was seriously searching in the net on how to create a simple registration form eventhough it seems to be very simple it is definitely a tedious task and you have made me an expert in this filed.Well donehttp://www.powered.com/
23 January
2014
sundari
how do i compare the values in registration table likely username password, to check the login table both of them match and then print the message. please give a coding in php.
05 January
2014
Satyam upadhyay
nice
05 November
2013
James Dean
Where does the code for saving the data into mysql table go. Is it in the registration form?
22 January
2014
Ali
I would like the answer to that question as well--.
comments powered by Disqus