<!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>Greeting service</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
</head>
<body>
<h1>Greeting service</h1>
<?php
if(isset($_GET['submitted'])) {
$name=$_GET['name'];
if(empty($name)) {
print "<div>I refuse to greet an anonymous user</div>\n";
}
else {
print "<div>Hello $name!</div>\n";
}
}
else {
print "<form action=\"greet.php\" method=\"get\">\n";
print "<div><input type=\"hidden\" name=\"submitted\" value=\"1\" /></div>\n";
print "<p>Your name <input type=\"text\"";
print " name=\"name\"";
if(isset($name)) {
print "value=\"$name\"";
print "/></p></form>\n";
}
}
?>
<p>
<a href="http://validator.w3.org/check?uri=referer"><img
style="border: 0pt"
src="/valid-xhtml10.png"
alt="Valid XHTML 1.0!" height="31" width="88" /></a>
</p>
</body>
</html>