...

View Full Version : I am getting an error as "undefined index" in line 3 in below program



akhilreddy
07-14-2012, 03:32 PM
<?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);
?>

MarPlo
07-14-2012, 05:30 PM
Hi,
Line 3 is:

$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" .



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum