simple online form stuck at !isset($first) condition
| From: | Wei Wang | Date: | Mon, 15 Sep 2003 23:35:18 +0000 |
| Subject: | simple online form stuck at !isset($first) condition | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-162685@lists.php.net to get a copy of this message | ||
hi, all,
I have this code at http://weiwang.freeshell.org/formprac.php and
the execution kept stuck at
the condition part of:
if(!isset($first)) {
show_form();
}
Even if I input some text into both field and click submit, the execution wouldn't go to any
other
conditional branch and be stuck at this one.
Any advice would be greatly appreciated.
Wei Wang
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<h2>Simple Form Example</h2>
<? function show_form($first="",$last="") { ?>
<form action="formprac.php" method="POST">
First Name:
<input type=text name=first value="<?echo $first?>">
<br>
Last Name:
<input type=text name=last value="<?echo $last?>">
<br>
<input type=submit>
</form>
<? }
if(!isset($first)) {
show_form();
}
else {
if(empty($first) or empty($last)) {
echo "You did not fill in all the
fields, try again<p>";
show_form($first,$last);
}
else {
echo "Thank you, $first $last";
}
}
?>
</body>
</html>