Undefined Index 2
Posted: Wed Jul 31, 2002 8:53 pm
I saw another topic relating to this PHP error. The "solution" does not help me, however. I have a script below that keeps complaining about:
Notice: Undefined index: age ... in xxx.php on line 3. age is to be filled out in the form.
YES, the other value, e.g. E_ERROR, on error_reporting can suppress the error. However, as a newbie, I do want to keep it to E_ALL in order to understand more about the behaviour of PHP. My register_globals is On. Other environment info: Win2k/IIS/PHP 4.2.2. Can someone please kindly help me?

Notice: Undefined index: age ... in xxx.php on line 3. age is to be filled out in the form.
YES, the other value, e.g. E_ERROR, on error_reporting can suppress the error. However, as a newbie, I do want to keep it to E_ALL in order to understand more about the behaviour of PHP. My register_globals is On. Other environment info: Win2k/IIS/PHP 4.2.2. Can someone please kindly help me?
Code: Select all
<html><head><title>Age Comparison</title></head><body>
<?php
$your_age=$_POSTї'age'];
if (is_null($your_age)) {
?>
<form action="<?php echo $_SERVERї'PHP_SELF'] ?>" method="POST">
Age:
<input type="text" name="age" /> <br />
<input type=submit name="age compare" />
</form>
<?php
} else {
$age_diff=($age-16);
if ($age_diff < 0) {
print ("You are younger than me");
}
else {
print ("I am younger than you");
}
}
?>
</body></html>