SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2007
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how to fix this bug

    PHP Code:
    <?php
    $con
    =mysql_connect("localhost","root","");
    mysql_select_db("user",$con);
      
    $username mysql_real_escape_string($_POST['username']);
      
    $password mysql_real_escape_string($_POST['password']);
      
    $email mysql_real_escape_string($_POST['email']);
      
    $add mysql_real_escape_string($_POST['address']);
      
    $contry=mysql_real_escape_string($_POST['country']);
      
    $area=mysql_real_escape_string($_POST['area']);
      
    $pin=mysql_real_escape_string($_POST['pin']);
      
    $countrycode=mysql_real_escape_string($_POST['countrycode']);
      
    $phoneno=mysql_real_escape_string($_POST['phoneno']);
      
    $file=mysql_real_escape_string($_POST['file']);
      
    $qry="INSERT INTO user1 (username,password,email,address,country,area,pincode,countrycode,phoneno,file) VALUES ('$username','$password','$email','$add','$contry','$area','$pin','$countrycode','$phoneno','$file')";
      
    mysql_query($qry,$con);
      
    mysql_close($con);
      
    ?>
    i am getting following errors:

    Notice: Undefined index: password in c:\easyphp1-8\www\register.php on line 11

    Notice: Undefined index: area in c:\easyphp1-8\www\register.php on line 15

    Notice: Undefined index: file in c:\easyphp1-8\www\register.php on line 19

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,839
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Check what names the form fields have in the form on the prior page.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    SitePoint Zealot
    Join Date
    Mar 2007
    Posts
    192
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    those arent bugs, they are more.. syntax/coding errors.

    check your names of form elements, and you should also check to make sure each of those _POST elements exist, that way you can avoid ugly error messages if someone tries to make their own query string without using your form.

  4. #4
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,806
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    If this is a continuation of your previous threads then:

    Notice: Undefined index: area in c:\easyphp1-8\www\register.php on line 15
    is caused because you have an empty <select>
    Code:
    <select name="area" size="1" multiple="multiple" id="area">
    </select>
    This was answered in your previous thread

    Notice: Undefined index: password in c:\easyphp1-8\www\register.php on line 11
    spelling error - answered in your other thread

    Notice: Undefined index: file in c:\easyphp1-8\www\register.php on line 19

    because file inputs aren't passed through the POST array, they are handled by the $_FILES array.

    search for file uploads for more info
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....


Bookmarks

Posting Permissions

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