simple form post
Posted: Wed Aug 03, 2005 12:04 am
I'm a newbie trying to get the following code to work, and the POST handling works the way I expects (it echoes that one line), but when it's just a GET, it doesn't output the form anymore. How do I write this properly in PHP? My hosting company is using 4.3.10, I think. Thanks...
Code: Select all
<html>
<head>
</head>
<body>
<?
$os = $_GET["os"];
if(!(isset($os))) {
$os = $_POST["os"];
$myname = $_POST["myname"];
if (isset($myname)) {
echo "Your name is $myname.";
}
} else {
?>
<form method="post" ><div>
First Name: <input type="text" name="first" value="">
<br />
Last Name: <input type="text" name="last" value="">
<br />
Number of guests including yourself: <input type="text" name="total" value="">
<br />
Comments: <input type="text" name="comments" value="">
<input type="hidden" name="os" value="ds">
<input type=submit value="Go!"></div>
</form>
<?
} # end if os is set
?>
</body>
</html>