here is the code:
<?php
echo $_POST['name'];
echo $_POST['age'];
echo $_POST['occupation'];
if ($_POST['submit'])
{
$name = $_POST['name'];
$age = $_POST['age'];
$occupation = $_POST['occupation'];
$errorstring = "";
if (!$name)
$errorstring = $errorstring.'Name<br>';
if (!$age)
$errorstring = $errorstring.'Age<br>';
if (!$occupation)
$errorstring = $errorstring.'Occupation<br>';
if ($errorstring = "")
echo 'Please fill out the following fields:<br>'. $errorstring;
else
{
die("success!");
}
}
?>
and this I see in the browser:
Notice: Undefined index: name in C:\wamp\www\form.php on line 41
Notice: Undefined index: age in C:\wamp\www\form.php on line 42
Notice: Undefined index: occupation in C:\wamp\www\form.php on line 43
Notice: Undefined index: submit in C:\wamp\www\form.php on line 45
May I please know what is the problem here?
Jan 22, 2011