How to create register form on your web application for users..
1 create a table in your database and table fields are name, email, address, mobile, password, status=0 etc.
2 Create a form and submit all details in your table with the help of insert operation.
3 Also check user is already registered or not if user already registered in your DB print the massage (You are already registered please login with username and password.).
4 After registration user have not permission to enter in admin area in web application because the value of user status=0. .
5 admin approved user from admin panel to provide permission to user to access the admin area of web application and when admin approve the user from admin panel the status of user change to 1.
4 After registration user have not permission to enter in admin area in web application because the value of user status=0. .
5 admin approved user from admin panel to provide permission to user to access the admin area of web application and when admin approve the user from admin panel the status of user change to 1.
//                                                           Code                                          //
<form action="" method="post" enctype="multipart/form-data">
  <div class="form-group">
    <label for="exampleInputEmail1">Your Name</label>
    <input type="name" class="form-control" id="name" name="name" placeholder="Your Name">
  </div>
  <div class="form-group">
    <label for="exampleInputEmail1">Email address</label>
    <input type="email" class="form-control" id="email" name="email" placeholder="Email address">
  </div>
  <div class="form-group">
    <label for="exampleInputEmail1">Address</label>
    <input type="address" class="form-control" id="address" name="address" placeholder="Address">
  </div>
  <div class="form-group">
    <label for="exampleInputEmail1">Mobile Number</label>
    <input type="mobile" class="form-control" id="mobile" name="mobile" placeholder="Mobile Number">
  </div>
  <div class="form-group">
    <label for="exampleInputPassword1">Password</label>
    <input type="password" class="form-control" id="password" name="password" placeholder="Password">
  </div>
<input type="submit" class="btn btn-default" id="submit" name="submit" value="Register">
 </form>
 2 PHP Part
 <?php
include "config.php";
$msg6='';
$count=0;
if(isset($_POST['submit']) && ($_POST['submit']=="Register"))
{
 $sql="select * from user where name='".$_POST['name']."' and email='".$_POST['email']."'";
$row = mysql_query($sql);
$count=mysql_num_rows($row);
if($count==0)
{
 $sql="insert into user(name, email, address, mobile, password) value('".$_POST['name']."', '".$_POST['email']."', '".$_POST['address']."', '".$_POST['mobile']."', '".$_POST['password']."')";
$run=mysql_query($sql);
}
else
{
$msg6 ="You are already registered please login with username and password.";
}
}
?>
Comments
Post a Comment