Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include 'connect.php';
- if(isset($_REQUEST['submit'])){
- $fname = $_POST['fname'];
- $lname = $_POST['lname'];
- $other = $_POST['other'];
- $email = $_POST['email'];
- $username = $_POST['username'];
- $password = $_POST['password'];
- $confirmpassword = $_POST['confirmpassword'];
- $gender = $_POST['gender'];
- $dob = $_POST['dob'];
- $address = $_POST['address'];
- if(!empty($fname) && !empty($lname) && !empty($other) && !empty($email) && !empty($username) && !empty($password) && !empty($confirmpassword) && !empty($gender) &&
- !empty($dob) && !empty($address)){
- if($password == $confirmpassword){
- if(strlen($password) < 6 || strlen($password) > 15){
- $message= 'Password must be between 6 and 15 characters ';
- }else{
- if(strlen($username) < 4 || strlen($username) > 9){
- $message= 'Username must be between 4 and 8 characters';
- }else{
- if(is_numeric($dob)){
- $message= 'Date of birth must be numbers';
- }else{
- if(strlen($dob)!== 10){
- $message= 'Date of Birth is Invalid';
- }else{
- $query = "INSERT INTO members (fname, lname, other, email, username, password, dob, gender, address) VALUES
- ('$fname', '$lname', '$other','$email', '$username', '$password', '$dob', '$gender', '$address')";
- $db = mysql_query($query);
- $message= 'You have been Registered';
- }
- }
- }
- }
- }else{
- $message= 'Passwords do not match';
- }
- }else{
- $message= 'All fields are required';
- }
- }else{
- $message= "";
- }
- ?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Register Here</title>
- <link rel="stylesheet" href="css/style.css" type="text/css">
- </head>
- <body>
- <div id="container">
- <div class="head">
- School Portal
- </div>
- <div id="sideleft">
- <div class="sideleft">
- <ul>
- <li><a href="index.php" title="">Home Page</a></li>
- <li><a href="reg.php" title="">Register</a></li>
- </ul>
- </div>
- </div>
- <div id="sideright";>
- <h4>Register Here</h4>
- <form action="reg.php" method="post">
- <table>
- <font face="Times New Roman, Times, serif" color="#CC0000"><?php echo $message; ?></font>
- <tr>
- <td>First Name</td>
- <td><input type="text" name="fname"></td>
- </tr>
- <tr>
- <td>Last Name</td>
- <td><input type="text" name="lname"></td>
- </tr>
- <tr>
- <td>Other Name</td>
- <td><input type="text" name="other" ></td>
- </tr>
- <tr>
- <td>Email</td>
- <td><input type="email" name="email" ></td>
- </tr>
- <tr>
- <td>Username</td>
- <td><input type="text" name="username" ></td>
- </tr>
- <tr>
- <td>Pasword</td>
- <td><input type="password" name="password" ></td>
- </tr>
- <tr>
- <td>Confirm Password</td>
- <td><input type="password" name="confirmpassword" ></td>
- </tr>
- <tr>
- <td>Gender</td>
- <td><select name="gender" >
- <option>----</option>
- <option>Male</option>
- <option>Female</option>
- </select>
- </td>
- </tr>
- <tr>
- <td>Date of Birth</td>
- <td><input type="text" name="dob" ></td>
- </tr>
- <tr>
- <td>Address</td>
- <td><textarea name="address" cols="15" rows="5" >
- </textarea></td>
- </tr>
- <tr>
- <td> </td>
- <td><input type="submit" name="submit" value="Register"></td>
- </tr>
- </table>
- </form>
- </div>
- </div>
- </body>
- </html>
Add Comment
Please, Sign In to add comment