One-script form processing : Form Post « Form « PHP






One-script form processing

 
//File: index.php
<html>
<head>
<title></title>
</head>
<body>
<?
$form = "<form action=\"index.php\" method=\"post\">
<input type=\"hidden\" name=\"seenform\" value=\"y\">
<b>Give us some information!</b><br>
Your Name:<br>
<input type=\"text\" name=\"name\" size=\"20\" maxlength=\"20\" value=\"\"><br>
Your Email:<br>
<input type=\"text\" name=\"email\" size=\"20\" maxlength=\"40\" value=\"\"><br>
<input type=\"submit\" value=\"subscribe!\">
</form>";
if ($seenform != "y"):
     print "$form";
else :
     print "Hi, $name!. Your email address is $email";
endif;
?>
</body>
</html>
  
  








Related examples in the same category

1.An HTML Form That Calls Itself
2.Combined Feedback Form
3.Form submitting
4.GET vs. POST
5.Making a multipage form
6.Preventing Multiple Submissions on the Client Side
7.Preventing Multiple Submissions on the Server Side