+ Reply to Thread
Results 1 to 4 of 4

Thread: Registration script problem
      
   

  1. #1
    SirChick is offline Sergeant
    Join Date
    Jun 2007
    Posts
    24

    Default 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']; 

  2. #2
    navaldesign's Avatar
    navaldesign is offline General & Forum Moderator
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,061

    Default 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!


  3. #3
    Watdaflip's Avatar
    Watdaflip is offline Major General
    Join Date
    Sep 2005
    Location
    Cincinnati, Ohio
    Posts
    2,119

    Default 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

  4. #4
    navaldesign's Avatar
    navaldesign is offline General & Forum Moderator
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,061

    Default 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!


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49