2.Create form with the help of HTML
3.Create Database "weg".
4.Create table "reg(name,email,password,re_password);"
5.Create Connection with "$db=mysqli_connect('localhost','root','','web');"
6..Now start coding whitch insert data in database.
SOURCE CODE:
<?php
$db=mysqli_connect('localhost','root','','web');
if(isset($_POST['regis'])){
$nam = $_POST['name'];
$email = $_POST['mail'];
$pass = $_POST['pass'];
$r_pass = $_POST['re_pass'];
if($pass==$r_pass){
$pass=md5($r_pass);
$que="INSERT INTO reg(name,email,password,re_password)
VALUES('$nam','$email','$pass','$r_pass')";
$run =mysqli_query($db,$que);
}
else{
$_SESSION['message']="Two Password do not match";
}
}
?>
<DOCTYPE! hrml>
<head>
<title>User Registration Form</title>
</head>
<body>
<form action="suc.php" method="post">
<center>
<table>
<tr><td>Registration Form</td><tr>
<tr>
<th>Name</th>
<td><input type="text" name="name"></td>
</tr>
<tr>
<th>Email</th>
<td><input type="email" name="mail"></td>
</tr>
<tr>
<th>Password</th>
<td><input type="password" name="pass"></td>
</tr>
<tr>
<th>Retype Password</th>
<td><input type="password" name="re_pass"></td>
</tr>
<tr>
<td><input type="submit" name="regis"></td>
</tr>
</table>
</form>
</body>
</html>
OUTPUT
nice
ReplyDelete