9 responses to “Creating a Registration Page with PHP and PDO.”

  1. gremeir mitz ociones

    $query = $db->prepare( $sql );
    $query->execute( array( ‘:username’=>$username, ‘:password’=>$password, ‘:first_name’=>$first_name, ‘:surname’=>$surname, ‘:address’=>$address, ‘:email’=>$email ) );

    $result = $query->execute( array( ‘:username’=>$username, ‘:password’=>$password, ‘:first_name’=>$first_name, ‘:surname’=>$surname, ‘:address’=>$address, ‘:email’=>$email ) );
    very redundant .
    this will create double entry to the database ..
    you can try this directly if you want to check it is already submitted to the db:

    $query = $db->prepare( $sql );
    $result = $query->execute( array( ‘:username’=>$username, ‘:password’=>$password, ‘:first_name’=>$first_name, ‘:surname’=>$surname, ‘:address’=>$address, ‘:email’=>$email ) );

  2. Gary

    Brilliant tutorial! Thanks very much! Would be great if at some point you could maybe add a verification process to this? So the form generates an MD5 code or something and sends them an email, once they confirm their address by clicking an email link it moves them from a standby table to a confirmed table or something? Just a thought :)

  3. Codi

    Once I get to the step, “We then distill the $_POST array into more manageable variables for ease and clarity:” I am receiving A LOT of errors that state:

    ‘Notice: Undefined index: username in C:\wamp\www\registration\registration.php on line 36′

    ‘Notice: Undefined index: password in C:\wamp\www\registration\registration.php on line 37′

    ‘ Notice: Undefined index: first_name in C:\wamp\www\registration\registration.php on line 38′

    … and so on with all of the $form elements that are part of that step. If you could help me out or point me to a direction that may fix this, that would be great.

  4. Noel


    I am getting an error,
    Parse error: syntax error, unexpected ‘$regform’ (T_VARIABLE) in C:\xampp\htdocs\register.php on line 3

    This is my code:

    Please send me an email as reply!

  5. Oscar

    Good tutorial though i have done all that you have in the tutorial but mine does not post data to the table.This is my code
    prepare( $sql );
    $result = $query->execute( array(
    ‘:[value-2]’ => $nameofgroup,
    ‘:[value-3]’ => $firstname,
    ‘:[value-4]’ => $secondname,
    ‘:[value-5]’ => $lastname,
    ‘:[value-6]’ => $age,
    ‘:[value-7]’ => $residence,
    ‘:[value-8]’ => $pbirth,
    ‘:[value-9]’ => $yowidowhood,
    ‘:[value-10]’ => $nodependants,
    ‘:[value-12]’ => $edulevel,
    ‘:[value-13]’ => $contact,
    ‘:[value-14]’ => $nexkinconts,

    $connection = null; // Disconnect

    header(“location: success.php?remarks=success”);


  6. eve kilel

    Hi, am a beginner and I don’t understand why we should have two separate php tags before and after the form
    as shown above, kindly please need your help.

Leave a Reply