Jump to content

Recommended Posts

Posted (edited)

Php Gurus,

I built a registration.php but I know not why I see a blank page after clicking "Register" button.
Ignore the <center> tag for the time being. Will replace that with <p align> tag. I put echoes on conditions to see which part of the conditions get triggered. But the echoes don't occur.

And, out of the following 2, which one suits my context ?

            
$row = mysqli_fetch_array($result, MYSQLI_ASSOC); // Use this line or next ?
$row = mysqli_stmt_fetch($stmt); //Use this line or previous ? 

registration.php

	<?php
	    /*
    ERROR HANDLING
    */
    declare(strict_types=1);
    ini_set('display_errors', '1');
    ini_set('display_startup_errors', '1');
    error_reporting(E_ALL);
    mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
	    include 'config.php';
	    //Step 1: Before registering User account, check if User is already 
    registered or not.
	    //Check if User is already logged-in or not.
    if (is_logged() === true) {
        die("You are already logged-in! No need to register again!");
    }
	    if ($_SERVER['REQUEST_METHOD'] == "POST")
    {
    //Step 2: Check User Submitted Details.
    
        //Check if user made all the required inputs or not.
        if (isset($_POST["username"]) && 
           isset($_POST["password"]) &&
           isset($_POST["password_confirmation"]) && 
           isset($_POST["email"]) && 
           isset($_POST["email_confirmation"]) && 
           isset($_POST["first_name"]) && 
           isset($_POST["surname"]) && 
           isset($_POST["gender"])) {
           
    //Step  3: Check User details for matches against database. If no matches 
    then validate inputs and register User account.
           
            //Create variables based on user inputs.
            $username     = trim($_POST["username"]);
            $password     = $_POST["password"];
            $password_confirmation = $_POST["password_confirmation"];
            $email         = trim($_POST["email"]);
            $email_confirmation = trim($_POST["email_confirmation"]);
            $first_name    = trim($_POST["first_name"]);
            $surname     = trim($_POST["surname"]);
            $gender     = $_POST["gender"];    
               $account_activation_code = sha1( (string) mt_rand(5, 30)); //Type 
    Casted the INT to STRING on the 1st parameter of sha1 as it needs to be a 
    STRING.
            $account_activation_link = 
    "http://www.".$site_domain."/".$social_network_name."/activate_account.php?
  
  email=".$_POST['email']."&account_activation_code=".$account_activation_code."";
            $account_activation_status = 0; // 1 = active; 0 = not active.
            $hashed_password = password_hash($password, PASSWORD_DEFAULT); 
    //Encrypt the password.
        
            //Select Username and Email to check against Mysql DB if they are 
    already registered or not.
            $stmt = mysqli_prepare($conn, "SELECT usernames, emails FROM users 
    WHERE usernames = ? OR emails = ?");
            mysqli_stmt_bind_param($stmt, 'ss', $username, $email);
            mysqli_stmt_execute($stmt);
            $result = mysqli_stmt_bind_result($stmt, $db_username, $db_email);    
            //$row = mysqli_fetch_array($result, MYSQLI_ASSOC); // Use this line 
    or next ?
            $row = mysqli_stmt_fetch($stmt); //Use this line or previous ?    
        
            // Check if inputted Username is already registered or not.
            if ($row['usernames'] == $username) {
                $_SESSION['error'] = "That username is already registered.";
                exit();
            // Check if inputted Username is between the required 8 to 30 
    characters long or not.
            } elseif (strlen($username) < 8 || strlen($username) > 30) {
                $_SESSION['error'] = "Username must be between 8 to 30 
    characters long!";
                exit();
            // Check if both inputted Emails match or not.
            } elseif ($email != $email_confirmation) {
                $_SESSION['error'] = "Emails don't match!";
                exit();
            // Check if inputed Email is valid or not.
            } elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
                $_SESSION['error'] = "Invalid email! Insert your real Email in 
    order for us to email you your account activation details.";
                exit();
            // Check if inputted Email is already registered or not.
            } elseif ($row['emails'] == $email) {
                $_SESSION['error'] = "That email is already registered.";
                exit();
            // Check if both inputted Passwords match or not.
            } elseif ($password != $password_confirmation) {
                $_SESSION['error'] = "Passwords don't match.";
                exit();
            // Check if Password is between 8 to 30 characters long or not.
            } elseif (strlen($password) < 8 || strlen($password) > 30) {
                $_SESSION['error'] = "Password must be between 6 to 30 
    characters long!";
                exit();
                echo "line 88";
            } 
            else 
            {
                //Insert the user's inputs into Mysql database using php's sql 
    injection prevention method "Prepared Statements".
                $stmt = mysqli_prepare($conn, "INSERT INTO users(usernames, 
    passwords, emails, first_names, surnames, genders, 
    accounts_activations_codes, accounts_activations_statuses) VALUES (?, ?, ?, 
    ?, ?, ?, ?, ?)");
                mysqli_stmt_bind_param($stmt, 'sssssssi', $username, 
    $hashed_password, $email, $first_name, $surname, $gender, 
    $account_activation_code, $account_activation_status);
                mysqli_stmt_execute($stmt);
                echo "line 96";
            
                //Check if user's registration data was successfully submitted 
    or not.
                if (!$stmt)
                {
                    $_SESSION['error'] = "Sorry! Our system is currently 
    experiencing a problem registering your account! You may try registering 
    some other time.";
                    echo "line 102";
                    exit();
                }
                else 
                {
                    echo "line 107";
                    //Email the account activation link for user to click it to 
    confirm their email and activate their new account.
                    $to = $email;
                    $subject = "Your ".$site_name." account activation 
    details!";
                    $body  = nl2br("
                    ===============================\r\n
                    ".$site_name." \r\n
                    ===============================\r\n
                    From: ".$site_admin_email."\r\n
                    To: ".$email."\r\n
                    Subject: Yours ".$subject." \r\n
                    Message: ".$first_name." ".$surname."\r\n You need to click 
    on this following <a href=".$account_activation_link.">link</a> to activate 
    your account. \r\n");
                    $headers = "From: " . $site_admin_email . "\r\n";
            
                    if (!mail($to,$subject,$body,$headers)) 
                    {
                        $_SESSION['error'] = "Sorry! We have failed to email you 
    your account activation details. Please contact the website administrator!";
                        exit();
                    }
                    else
                    {
                        echo "<h3 style='text-align:center'>Thank you for your 
    registration!<br /> Check your email for details on how to activate your 
    account which you just registered.</h3>";
                        exit();
                    }
                }
            }
        }
    }
	    ?>
	    <!DOCTYPE html>
    <html>
        <head>
            <title><?php $social_network_name ?> Signup Page</title>
        </head>
    <body>
    <div class ="container">
	    <?php
    // Error Messages.
    if (isset($_SESSION['error']) && !empty($_SESSION['error'])) {
        echo '<p style="color:red;">'.$_SESSION['error'].'</p>';
    }
    ?>
	    <?php
    //Session Messages.
    if (isset($_SESSION['message']) && !empty($_SESSION['message'])) {
        echo '<p style="color:red;">'.$_SESSION['error'].'</p>';
    }
    ?>
	    <?php
    //Clear Registration Session.
    function clear_registration_session()
        {
            //Clear the User Form inputs, Session Messages and Session Errors so 
    they can no longer be used.
            unset($_SESSION['message']);
            unset($_SESSION['error']);
            unset($_POST);
            exit();
        }
    ?>
	    <form method="post" action="">
        <center><h2>Signup Form</h2></center>
        <div class="form-group">
            <center><label>Username:</label>
            <input type="text" placeholder="Enter a unique Username" 
    name="username" required [A-Za-z0-9] value="<?php 
    if(isset($_POST['username'])) { echo htmlentities($_POST['username']); }?>">
    </center>
        </div>
        <div class="form-group">
            <center><label>Password:</label>
            <input type="password" placeholder="Enter a new Password" 
    name="password" required [A-Za-z0-9]></center>
        </div>
        <div class="form-group">
            <center><label>Repeat Password:</label>
            <input type="password" placeholder="Repeat a new Password" 
    name="password_confirmation" required [A-Za-z0-9]></center>
        </div>
            <div class="form-group">
            <center><label>Email:</label>
            <input type="email" placeholder="Enter your Email" name="email" 
    required [A-Za-z0-9] value="<?php if(isset($_POST['email'])) { echo 
    htmlentities($_POST['email']); }?>"></center>
        </div>
        <div class="form-group">
            <center><label>Repeat Email:</label>
            <input type="email" placeholder="Repeat your Email" 
    name="email_confirmation" required [A-Za-z0-9] value="<?php 
    if(isset($_POST['email_confirmation'])) { echo 
    htmlentities($_POST['email_confirmation']); }?>"></center>
        </div>
        <div class="form-group">
            <center><label>First Name:</label>
            <input type="text" placeholder="Enter your First Name" 
    name="first_name" required [A-Za-z] value="<?php 
    if(isset($_POST['first_name'])) { echo htmlentities($_POST['first_name']); 
    }?>"></center>
        </div>
        <div class="form-group">
            <center><label>Surname:</label>
            <input type="text" placeholder="Enter your Surname" name="surname" 
    required [A-Za-z] value="<?php if(isset($_POST['surname'])) { echo 
    htmlentities($_POST['surname']); }?>"></center>
        </div>
        <div class="form-group">
            <center><label>Gender:</label>
            <input type="radio" name="gender" value="male" <?php 
    if(isset($_POST['gender'])) { echo 'checked'; }?> required>Male<input 
    type="radio" name="gender" value="female" <?php if(isset($_POST['gender'])) 
    { echo 'checked'; }?> required>Female</center>
        </div>
        <center><button type="submit" class="btn btn-default" 
        name="submit">Register!</button></center>
        <center><font color="red" size="3"><b>Already have an account ?</b><br>
    <a href="login.php">Login here!</a></font></center>
    </form>
    </div>
    </body>
    </html>
	

Edited by saversites
Posted
3 hours ago, administrator said:

If the echoes are not printing out, that tells you the conditions are returning false.

... So the first step is to figure out why this is happening: condition returning false. 

Stef

I put echoes on both IFs & ELSEs and so atleast one of them should echo.

  • 10 months later...
Posted (edited)
On 11/27/2017 at 4:10 AM, administrator said:

... I am guessing that your echo code is not placed in the spot that it is able to write to the page. 

I modified the script but no luck! One year has passed!

Hi,

Below is a membership or account registration page script.
I need to get the User to type the password twice. Final one as the confirmation.
I tried both the following for the "Not Equal To" operator after inputting mismatching inputs into the password input field and the password confirmation (re-type password field) field and none of them work as I do not get the alert that the passwords don't match.
!=
!==
My troubled lines:

1st Attempt no luck:

if ($password != $password_confirmation) { 
            echo "Passwords don't match!"; 
            exit(); 

2nd Attempt no luck either:

if ($password !== $password_confirmation) { 
            echo "Passwords don't match!"; 
            exit(); 


Even if I rid the exit(), still no luck to get the error that the passwords do not match.

My full script:

	<?php 
	//Required PHP Files. 
include 'config.php'; 
include 'header.php'; 
	//Step 1: Before registering user Account, check if User is already registered or not. 
	//Check if User is already logged-in or not. Get the login_check() custom FUNCTION to check. 
if (login_check() === TRUE) { 
    die("You are already logged-in! No need to register again!"); 
} 
	if ($_SERVER['REQUEST_METHOD'] == "POST") 
{ 
    //Step 2: Check User submitted details. 
    
    //Check if User made all the required inputs or not. 
    if (isset($_POST["fb_tos_agreement_reply"]) && 
       isset($_POST["username"]) && 
       isset($_POST["password"]) && 
       isset($_POST["password_confirmation"]) && 
       isset($_POST["fb_tos"]) && 
       isset($_POST["primary_website_domain"]) && 
       isset($_POST["primary_website_domain_confirmation"]) && 
       isset($_POST["primary_website_email_account"]) && 
       isset($_POST["primary_website_email_account_confirmation"]) && 
       isset($_POST["primary_website_email_domain"]) && 
       isset($_POST["primary_website_email_domain_confirmation"]) && 
       isset($_POST["first_name"]) && 
       isset($_POST["middle_name"]) && 
       isset($_POST["surname"]) && 
       isset($_POST["gender"]) && 
       isset($_POST["age_range"]) && 
       isset($_POST["working_status"]) && 
       isset($_POST["profession"])) { 
           
        //Step 3: Check User details for matches against database. If no matches then validate inputs to register User Account. 
           
        //Create Variables based on user inputs. 
        $fb_tos_agreement_reply = trim($_POST["fb_tos_agreement_reply"]); 
        $username = trim($_POST["username"]); 
        $password = $_POST["password"]; 
        $password_confirmation = $_POST["password_confirmation"]; 
        $primary_website_domain = trim($_POST["primary_website_domain"]); 
        $primary_website_domain_confirmation = trim($_POST["primary_website_domain_confirmation"]); 
        $primary_website_email_account = trim($_POST["primary_website_email_account"]); 
        $primary_website_email_account_confirmation = trim($_POST["primary_website_email_account_confirmation"]); 
        $primary_website_email_domain = trim($_POST["primary_website_email_domain"]); 
        $primary_website_email_domain_confirmation = trim($_POST["primary_website_email_domain_confirmation"]); 
        $primary_website_email = "$primary_website_email_account@$primary_website_email_domain"; 
        $first_name = trim($_POST["first_name"]); 
        $middle_name = trim($_POST["middle_name"]);         
        $surname = trim($_POST["surname"]); 
        $gender = $_POST["gender"]; 
        $age_range = $_POST["age_range"]; 
        $working_status = $_POST["working_status"]; 
        $profession = $_POST["profession"]; 
           $account_activation_code = sha1( (string) mt_rand(0, 99999999)); //Type Casted the INT to STRING on the 11st parameter of sha1 as it needs to be a string. 
        //$account_activation_link = "http://www.".$site_domain."/".$social_network_name."/activate_account.php?primary_website_email="."$primary_website_email_account $primary_website_email_domain"."&account_activation_code=".$account_activation_code."";
        $account_activation_link = "http://www.\".$site_domain.\"/\".$social_network_name.\"/activate_account.php?primary_website_email=\".\"$primary_website_email_account\".\"@\".\"prmary_website_domain\".\"&account_activation_code=\".\"account_activation_code\"";
        
        $account_activation_status = 0; //1 = active; 0 = inactive. 
        $hashed_password = password_hash($password, PASSWORD_DEFAULT); //Encrypt the password. 
        
        //Select Username and Email to check against Mysql DB if they are already regsitered or not. 
        $stmt = mysqli_prepare($conn,"SELECT username, primary_website_domain, primary_website_email FROM users WHERE username = ? OR primary_website_domain = ? OR primary_website_email = ?"); 
        mysqli_stmt_bind_param($stmt,'sss', $username, $primary_website_domain, $primary_website_email); 
        mysqli_stmt_execute($stmt); 
        $result = mysqli_stmt_get_result($stmt); 
        $row = mysqli_fetch_array($result, MYSQLI_ASSOC); 
        
        if (strlen($fb_tos_agreement_reply) < 1 || $fb_tos_agreement_reply !== "Yes") { 
            echo "You must agree to our <a href='tos.html'>Terms & Conditions</a>!"; 
            echo "$fb_tos"; 
            exit(); 
        //Check if inputted Username is already registered or not. 
        } elseif ($row['username'] == $username) { 
            echo "That Username is already registered!"; 
            exit(); 
        //Check if inputted Username is between the required 8 to 30 characters long or not. 
        } elseif (strlen($username) < 8 || strlen($username) > 30) { 
            echo "Username has to be between 8 to 30 characters long!"; 
            exit(); 
        //Check if both inputted Email Accounts match or not. 
        } elseif ($primary_website_email_account != $primary_website_email_account_confirmation) { 
            echo "Email Accounts don't match!"; 
            //exit(); 
        //Check if both inputted Email Domains match or not. 
        } elseif ($primary_website_email_domain != $primary_website_email_domain_confirmation) { 
            echo "Email Domains don't match!"; 
            //exit(); 
        //Check if inputted Email is valid or not. 
        } elseif (!filter_var($primary_website_email, FILTER_VALIDATE_EMAIL)) { 
            echo "Invalid Email! Your Email Domain must match your Domain Name! Insert your real Email (which is under your inputted Domain) for us to email you your 'Account Acivation Link'."; 
        //Check if inputted Email is already regsitered or not. 
        } elseif ($row['primary_website_email'] == $primary_website_email) { 
            echo "That Email is already registered!"; 
            exit(); 
        //Check if both inputted Passwords match or not. 
        } elseif ($password != $password_confirmation) { 
            echo "Passwords don't match!"; 
            exit(); 
        //Check if Password is between 8 to 30 characters long or not. 
        } elseif (strlen($password) < 8 || strlen($password) > 30) { 
            echo "Password must be between 8 to 30 characters long!"; 
            exit(); 
        } 
        else 
        { 
            //Insert the User's inputs into Mysql database using Php's Sql Injection Prevention Method "Prepared Statements". 
            $stmt = mysqli_prepare($conn,"INSERT INTO users(username,password,primary_website_domain,primary_website_email,first_name,middle_name,surname,gender,age_range,working_status,profession,account_activation_code,account_activation_status) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)"); 
            mysqli_stmt_bind_param($stmt,'ssssssssssssi', $username,$hashed_password,$primary_website_domain,$primary_website_email,$first_name,$middle_name,$surname,$gender,$age_range,$working_status,$profession,$account_activation_code,$account_activation_status); 
            mysqli_stmt_execute($stmt); 
            
            //Check if User's registration data was successfully submitted or not. 
            if (!$stmt) 
            { 
                echo "Sorry! Our system is currently experiencing a problem registering your account! You may try registering some other time!"; 
                exit(); 
            } 
            else                 
            { 
                //Email the Account Activation Link for the User to click it to confirm their email and activate their new account. 
                $to = "$email";                 
                $subject = "Your ".$site_name." account activation details"; 
                $body = nl2br(" 
                ===============================\r\n 
                ".$site_name." \r\n 
                ===============================\r\n 
                From: ".$site_admin_email."\r\n 
                To: ".$email."\r\n 
                Subject: Your ".$subject."\r\n 
                Message: ".$first_name." ".$surname."\r\n 
                You need to click on this following <a href=".$account_activation_link.">link</a> to activate your account.\r\n
                "); 
                $headers = "From: ".$site_admin_email."\r\n"; 
            
                if (!mail($to,$subject,$body,$headers)) 
                { 
                    echo "Sorry! We have failed to email you your Account Activation details. Please contact the website administrator!"; 
                    exit(); 
                } 
                else 
                { 
                    echo  "<h3 style='text-align:center'>Thank you for your registration!<br /> Check your email $primary_website_email for details on how to activate your account which you just registered.<h3>"; 
                    exit(); 
                } 
            } 
        } 
    } 
} 
	?> 
	<!DOCTYPE html> 
<html> 
    <head> 
        <title><?php echo "$social_network_name"; ?> Signup Page</title> 
    </head> 
<body> 
<div class ="container"> 
	<?php 
//Error Messages. 
if (isset($_SESSION['error']) && !empty($_SESSION['error'])) { 
    echo '<p style="color:red;">'.$_SESSION['error'].'</p>'; 
} 
?> 
	<?php 
//Session Messages. 
if (isset($_SESSION['message']) && !empty($_SESSION['message'])) { 
    echo '<p style="color:red;">'.$_SESSION['error'].'</p>'; 
} 
?> 
	<?php 
//Clear Registration Session. 
function clear_registration_session() 
    { 
        //Clear the User Form inputs, Session Messages and Session Errors so they can no longer be used. 
        unset($_SESSION['message']); 
        unset($_SESSION['error']); 
        unset($_POST); 
        exit(); 
    } 
?> 
	<form method="post" action=""> 
    <p align="left"><h2>Signup Form</h2></p> 
    <div class="form-group"> 
        <p align="left"><label>Username:</label> 
        <input type="text" placeholder="Enter a unique Username" name="username" required [A-Za-z0-9] autocorrect=off value="<?php if(isset($_POST['username'])) { echo htmlentities($_POST['username']); }?>"></p> 
    </div> 
    <div class="form-group"> 
        <p align="left"><label>Password:</label> 
        <input type="password" placeholder="Enter a new Username" name="password" required [A-Za-z0-9] autocorrect=off></p>     
    </div> 
    <div class="form-group">     
        <p align="left"><label>Repeat Password:</label> 
        <input type="password" placeholder="Repeat the new Password" name="password_confirmation" required [A-Za-z0-9] autocorrect=off></p> 
    </div> 
        <div class="form-group"> 
        <p align="left"><label>Primary Domain:</label> 
        <input type="text" placeholder="Enter your Primary Domain" name="primary_website_domain" required [A-Za-z0-9] autocorrect=off value="<?php if(isset($_POST['primary_website_domain'])) { echo htmlentities($_POST['primary_website_domain']); }?>"></p> 
    </div> 
        <div class="form-group"> 
        <p align="left"><label>Repeat Primary Domain:</label> 
        <input type="text" placeholder="Enter your Primary Domain Again" name="primary_website_domain_confirmation" required [A-Za-z0-9] autocorrect=off value="<?php if(isset($_POST['primary_website_domain_confirmation'])) { echo htmlentities($_POST['primary_website_domain_confirmation']); }?>"></p> 
    </div> 
        <div class="form-group"> 
        <p align="left"><label>Email Account:</label> 
        <input type="text" placeholder="Enter your Email Account" name="primary_website_email_account" required [A-Za-z0-9] autocorrect=off value="<?php if(isset($_POST['primary_website_email_account'])) { echo htmlentities($_POST['primary_website_email_account']); }?>"></p> 
    </div> 
    <div class="form-group"> 
        <p align="left"><label>Repeat Email Account:</label> 
        <input type="text" placeholder="repeat your Email Account" name="primary_website_email_account_confirmation" required [A-Za-z0-9] autocorrect=off value="<?php if(isset($_POST['primary_website_email_account_confirmation'])) { echo htmlentities($_POST['primary_website_email_account_confirmation']); }?>"></p> 
    </div> 
        <div class="form-group"> 
        <p align="left"><label>Email Domain:</label> 
        <input type="text" placeholder="Enter your Email Domain" name="primary_website_email_domain" required [A-Za-z0-9] autocorrect=off value="<?php if(isset($_POST['primary_website_email_domain'])) { echo htmlentities($_POST['primary_website_email_domain']); }?>"></p> 
    </div> 
    <div class="form-group"> 
        <p align="left"><label>Repeat Email Domain:</label> 
        <input type="text" placeholder="Repeat your Email Domain" name="primary_website_email_domain_confirmation" required [A-Za-z0-9] autocorrect=off value="<?php if(isset($_POST['primary_website_email_domain_confirmation'])) { echo htmlentities($_POST['primary_website_email_domain_confirmation']); }?>"></p> 
    </div> 
    <div class="form-group"> 
        <p align="left"><label>First Name:</label> 
        <input type="text" placeholder="Enter your First Name" name="first_name" required [A-Za-z] autocorrect=off value="<?php if(isset($_POST['first_name'])) { echo htmlentities($_POST['first_name']); }?>"></p> 
    </div> 
    <div class="form-group"> 
        <p align="left"><label>Middle Name:</label> 
        <input type="text" placeholder="Enter your Middle Name" name="middle_name" required [A-Za-z] autocorrect=off value="<?php if(isset($_POST['middle_name'])) { echo htmlentities($_POST['middle_name']); }?>"></p> 
    </div> 
    <div class="form-group"> 
        <p align="left"><label>Surname:</label> 
        <input type="text" placeholder="Enter your Surname" name="surname" required [A-Za-z] autocorrect=off value="<?php if(isset($_POST['surname'])) { echo htmlentities($_POST['surname']); }?>"></p> 
    </div> 
    <div class="form-group"> 
        <p align="left"><label>Gender:</label> 
        <input type="radio" name="gender" autocorrect=off value="male" <?php if(isset($_POST['gender'])) { echo 'checked'; }?> required>Male 
        <input type="radio" name="gender" autocorrect=off value="female" <?php if(isset($_POST['gender'])) { echo 'checked'; }?> required>Female</p>
    </div> 
    <div class="form-group"> 
        <p align="left"><label>Age Range:</label> 
        <input type="radio" name="age_range" value="18-20" <?php if(isset($_POST['age_range'])) { echo 'checked'; }?> required>18-20 
        <input type="radio" name="age_range" value="21-25" <?php if(isset($_POST['age_range'])) { echo 'checked'; }?> required>21-25 
        <input type="radio" name="age_range" value="26-30" <?php if(isset($_POST['age_range'])) { echo 'checked'; }?> required>26-30 
        <input type="radio" name="age_range" value="31-35" <?php if(isset($_POST['age_range'])) { echo 'checked'; }?> required>31-35 
        <input type="radio" name="age_range" value="36-40" <?php if(isset($_POST['age_range'])) { echo 'checked'; }?> required>36-40 
        <input type="radio" name="age_range" value="41-45" <?php if(isset($_POST['age_range'])) { echo 'checked'; }?> required>41-45 
        <input type="radio" name="age_range" value="46-50" <?php if(isset($_POST['age_range'])) { echo 'checked'; }?> required>46-50  
        <input type="radio" name="age_range" value="51-55" <?php if(isset($_POST['age_range'])) { echo 'checked'; }?> required>51-55 
        <input type="radio" name="age_range" value="56-60" <?php if(isset($_POST['age_range'])) { echo 'checked'; }?> required>56-60 
        <input type="radio" name="age_range" value="61-65" <?php if(isset($_POST['age_range'])) { echo 'checked'; }?> required>61-65  
        <input type="radio" name="age_range" value="66-70" <?php if(isset($_POST['age_range'])) { echo 'checked'; }?> required>66-70 
        <input type="radio" name="age_range" value="71-75" <?php if(isset($_POST['age_range'])) { echo 'checked'; }?> required>71-75</p>  
    </div>
    </div> 
    <div class="form-group"> 
        <p align="left"><label>Working Status:</label> 
        <input type="radio" name="working_status" value="Selfemployed" <?php if(isset($_POST['selfemployed'])) { echo 'checked'; }?> required>Selfemployed 
        <input type="radio" name="working_status" value="Employed" <?php if(isset($_POST['employed'])) { echo 'checked'; }?> required>Employed  
        <input type="radio" name="working_status" value="unemployed" <?php if(isset($_POST['unemployed'])) { echo 'checked'; }?> required>Unemployed</p>  
    </div> 
    <div class="form-group"> 
        <p align="left"><label>Profession:</label> 
        <input type="text" placeholder="Enter your Profession" name="profession" required [A-Za-z] autocorrect=off value="<?php if(isset($_POST['profession'])) { echo htmlentities($_POST['profession']); }?>"></p> 
    </div> 
    <div class="form-group"> 
        <p align="left"><label>Agree To Our Terms & Conditions ? :</label> 
        <input type="radio" name="fb_tos_agreement_reply" value="yes" <?php if(isset($_POST['fb_tos_agreement_reply'])) { echo 'checked'; }?> required>Yes  
        <input type="radio" name="fb_tos_agreement_reply" value="No" <?php if(isset($_POST['fb_tos_agreement_reply'])) { echo 'checked'; }?> required>No</p>  
    </div> 
    <p align="left"><button type="submit" class="btn btn-default" name=submit">Register!</button></p> 
    <p align="left"><font color="red" size="3"><b>Already have an account ?</b><br><a href="login.php">Login here!</a></font></p> 
</form> 
</div> 
</body> 
</html>
	

Edited by saversites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...