Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jul 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    I am getting an error as "undefined index" in line 3 in below program

    <?php
    $firstname=$_POST["txt1r"];
    $lastname=$_POST["txt2r"];
    $email=$_POST["txt3r"];
    $password=$_POST["txt4r"];
    $date=$_REQUEST["date"];
    $month=$_REQUEST["month"];
    $years=isset($_REQUEST["year"]);
    echo 'your name is '.$firstname.' '.$lastname;
    echo '<br>your email is '.$email;
    echo '<br>your password is '.$password;
    echo '<br>your date of birth '.$date.'-'.$month.'-'.$years;
    $con=mysql_connect("localhost","root","9441059334");
    if (!$con)
    {
    die('could not connect:'.mysql_error());
    }
    mysql_close($con);
    ?>

  • #2
    Regular Coder
    Join Date
    Mar 2011
    Posts
    148
    Thanks
    0
    Thanked 20 Times in 20 Posts
    Hi,
    Line 3 is:
    Code:
    $lastname=$_POST["txt2r"];
    The error means that there is not data send via POST with name "txt2r".
    Check if in the form there is the field with name="txt2r" .


  •  

    Posting Permissions

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