<!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">
<head>
<title>Saarland beer preference?</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
</head>
<body>


<?php

if(isset($_GET) && (! isset($_GET['submit']))) {
  print_form("<h1>What is your favorite beer from Saarland?</h1>");
  print_end();  
}
if(isset($_GET['beer']) && $beer=$_GET['beer']) {
  print "<div>\n";
  print "I am happy to know you like $beer. I like it too.\n";
  print_end();
}
print "<div>You don't like any beer from Saarland? What a shame.</div>\n";
print_form("<div>I give you another chance.</div>");
print_end();



function print_form ($greeting) {
  print "$greeting\n";
  print "<form action=\"".$_SERVER['PHP_SELF']."\" method=\"get\">\n";
  print "    <div>\n";
  print "    <input type=\"radio\" id=\"a_b\" name=\"beer\" value=\"Bruch\"/>\n";
  print "    <label for=\"a_b\">Bruch</label>\n";
  print "    <input type=\"radio\" id=\"a_g\" name=\"beer\" value=\"Grosswald\"/>\n";
  print "    <label for=\"a_g\">Grosswald</label>\n";
  print "    <input type=\"radio\" id=\"a_k\" name=\"beer\" value=\"Karlsberg\"/>\n";
  print "    <label for=\"a_k\">Karlsberg</label>\n";
  print "    <input type=\"submit\" value=\"submit\" name=\"submit\"/>\n";
  print "    </div>\n";
  print "</form>\n";
 }

function print_end () {
  print "<p>\n";
  print "<a href=\"http://validator.w3.org/check?uri=referer\"><img\n";
  print "    style=\"border: 0pt\"\n";
  print "    src=\"/valid-xhtml10.png\"\n";
  print "    alt=\"Valid XHTML 1.0!\" height=\"31\" width=\"88\" /></a>\n";
  print "</p>\n";
  print "</body>\n";
  print "</html>\n";
  // leave PHP here
  exit;
 }
?>









Valid XHTML 1.0!