Registration


Simple Registration Form

Registration Form
First Name
Last Name
User Name
Password
Email
Phone No

Registration.html

In this tutorial shows Registration form before login into the account

After submit the form it will directly link to the insert.php for inserting the data into database

<html>
<head>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<div id="container">
<form name="form" action="insert.php" method="POST">
<lable for="firstname">First Name</lable>
<input type="text" name="firstname" value=" ">
<lable for="lastname">Last Name</lable>
<input type="text" name="lastname" value=" ">
<lable for="username">UserName</lable>
<input type="text" name="username" value=" ">
<lable for="password">Password</lable>
<input type="password" name="password" value=" ">
<lable for="email">Email</lable>
<input type="text" name="email" value=" ">
<lable for="phone">Phone No</lable>
<input type="text" name="phone" value=" ">
<input type="submit" name="submit" value="Register">
</div>
</form>
</div>
</html>

connect.php

This is mysql connection page here we have to give hostname, username and password and database name

<?php
mysql_connect("localhost","root","123")or die("couldnot connect:". mysql_erro());
mysql_select_db("registration") or die("couldnot connect:". mysql_erro());
?>

Register.php

Finally this is the insertion page after submit the form ie registration.html the input values are sotred into Registration table

<?php
$query = "INSERT INTO registration
,(firstname,lastname,username,password,email,phone)VALUES('$_POST[firstname]','$_POST[lastname]','$_POST[username]','$_POST[password]','$_POST[email]','$_POST[phone]')";
$result = mysql_query($query);
header("location:login.html");
?>



No comments: