
416-22.1
Example of an html form that calls a php program
phpEx.html
<html>
<head>
<title>Simple php example</title>
</head>
<body>
<h1>Fill in this form</h1>
<form action="reply.php" method="post">
Enter your first name: <input type="text" name="fname" size="25" />
<br />
Enter your last name:
<input type="text" name="lname" size="25" />
<br />
Password:
<input type="password" name="pw" size="25" /> <br />
Enter a number:
<input type="text" name="numb" size="10" />
<br />
Box 1:<input type="checkbox" name="box1" value="b1" />
Box 2:<input type="checkbox" name="box2" value="b2" />
Box 3:<input type="checkbox" name="box3" value="b3" checked="checked" />
<br />
Radio 1<input type="radio" name="r1" value="r1" />
Radio 2<input type="radio" name="r1" value="r2" />
Radio 3<input type="radio" name="r1" value="r3" />
Radio 4<input type="radio" name="r1" value="r4" checked />
<br />
<input type="submit" value="Submit it!" />
<input type="reset" value="Start over" />
</form>
<hr />
<form action="killsession.php" method="post">
<input type="submit" value="Kill the session" />
</form>
</body>
</html>
killsession.php
<! killsession.php -->
<?php
session_start();
?>
<html><head><title>Kill the session</title></head>
<body>
<?php
session_destroy();
?>