Registration script problem

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • SirChick
    Sergeant

    • Jun 2007
    • 24

    Registration script problem

    This is the script, its not working for some reason ! I cannot understand why!

    PHP Code:
    <?php
    $username 
    $_POST['username'];
    $password $_POST['password'];
    $password2 = ['password2'];

    If (
    $password == $password2) {
    mysql_connect("localhost""blahblah""blah") or die mysql_error());
    mysql_select_db("databasename") or die mysql_error());
    mysql_query("INSERT INTO 'registrationdetails' (Username) Values ('$username')") or die(mysql_error()); }
    elseif (
    $password != $password2) {
    echo 
    "passwords did not match" };
    ?>
    this still wont work :S i think 'registrationdetails' (Username) Values ('$username')") is the part that is not working. I dont think $username is actually getting assigned to the string that the user inputted into the editbox, meaning the code is insert nothing so no new records are being made..

    this is the html for the edit box:

    HTML Code:
    <input type="text" id="Editbox2" size="16" name="Username" value="" maxlength="11">
    should it be
    PHP Code:
    $username $_POST['editbox2']; 
  • navaldesign
    General & Forum Moderator

    • Oct 2005
    • 12080

    #2
    Re: Registration script problem

    No. Your editbox (in the login form) is named "Username" so the string that is passed over to the verification script is "Username". Under this point of view, your script correctly has "username" but you need to change the editbox name in "username" with lowercase "u" .

    And, why you inserting in the database only the username and not the password also ?

    Also, as a good rule, the database fields should be the same as the php script and form variables. So, if you use "username" for the form and script, it would be wise that the database field for the username should be also "username" and not "Username" so that you will not get confused and make mistakes.
    Navaldesign
    Logger Lite: Low Cost, Customizable, multifeatured Login script
    Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
    DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
    Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

    Comment

    • Watdaflip
      Major General

      • Sep 2005
      • 2116

      #3
      Re: Registration script problem

      Also
      $password2 = ['password2'];
      needs to be
      $password2 = $_POST['password2'];

      You may also want to encrypt your password before inserting it into a database. As well as verify that you user filled in the information

      Register/Login Script
      Do you use a Password Protected Directory? Need a way to allow users to make their own account, try my .htaccess Login Script

      Comment

      • navaldesign
        General & Forum Moderator

        • Oct 2005
        • 12080

        #4
        Re: Registration script problem

        I need better glasses!!!! Thanks watdaflip!!
        Navaldesign
        Logger Lite: Low Cost, Customizable, multifeatured Login script
        Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
        DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
        Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

        Comment

        Working...
        X