A
<?
$sweets = array('puff' => 'A',
'square' => 'C',
'cake' => 'B',
'ricemeat' => 'S');
function show_form() {
print<<<_HTML_
<form method="post" action="$_SERVER[PHP_SELF]">
Your Order: <select name="order">
_HTML_;
foreach ($GLOBALS['sweets'] as $val => $choice) {
print "<option value=\"$val\">$choice</option>\n";
}
print<<<_HTML_
</select>
<br/>
<input type="submit" value="Order">
<input type="hidden" name="_submit_check" value="1">
</form>
_HTML_;
}
?>
Related examples in the same category