The codes below show how to process user's input with
php.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Please read the followings and c</title>
</head>
<body>
Please read the followings and choose the answers. What is 2 + 2<br>
<form method="POST" action="if_else_option.php">
<p><input type="radio" value="4" checked name="R1">4<br>
<input type="radio" name="R1" value="6">6<br>
<input type="radio" name="R1" value="8">8<br>
<input type="submit" value="Submit" name="B1"><input type="reset"
value="Reset" name="B2"></p>
</form>
</body>
</html>
Server Code
<?php
$test= $_POST[R1];
echo "Hi.$_POST[R1].<br>";
if ($test==4){ echo "Test Passed <br>"; }
else { echo "<br>sorry did not pass"; }
echo "welcome";
?>