This short PHP snippet shows how to remember form values when submitted through the post method. For a demo just copy and paste the code and test in your browser.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<body>
<form action="<?php echo htmlentities($_SERVER["PHP_SELF"]) ?>" method="post">
<fieldset><legend>Do You Drink?</legend>
<?php
$option = array('No','Yes, occasionally','Yes, frequently','Yes, like a fish');
foreach ($option as $no => $val) {
$selected = ( isset($_POST['drink']) AND $_POST['drink'] == $val ) ?
' checked="checked"' : '';
echo '<input type="radio" name="drink" id="drink'.
$no .'" value="'. $val .'"'. $selected .' />
<label for="drink'. $no .'">'. $val .'</label><br />';
}
?>
<br /><br />
<input type="submit" value="go" />
</fieldset>
</form>
<?php
if($_POST){
echo '<pre>';
print_r($_POST);
echo '</pre>';
}
?>
</body>
</html>