<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<?php
if(isset($_GET["goods"])){
$a=strval($_GET["goods"]);
$a = htmlspecialchars($a);
echo "<h1> 注文完了 </h1>" ;
echo "<p> ".$a." を注文しました </p>" ;
echo "<input type='button' οnclick='history.back()' value='back'>";
}else{
$goods=["おにぎり","チャーハン","アイス","ミルク","すし","みず"];
echo "<h1> 商品選択 </h1>" ;
echo "<form>";
echo "<select name='goods'>";
foreach($goods as $tmp)
{
echo "<option value='$tmp'>$tmp</option>";
}
echo "</select>";
echo "<input type='submit' value='OK'>";
echo "</form>";
}
/*
*
*/
//第6回宿題1
/*****************************/
/* if(isset($_GET["nenrel"])){
$year=$_GET["nenrel"];
$age=date("Y")-intval($year);
echo "今年".$age."歳です";
}else{
echo "<h1>age calculation</h1>";
echo "<form>";
echo "<select name='nenrel'>";
echo "<option>Please select your birth year.</option>";
$thisYear = date("Y");
$endYear = intval($thisYear) - 120;
while ($thisYear >= $endYear) {
echo "<option value='{$thisYear}'>西暦{$thisYear}年</option>";
$thisYear--;
}
echo "</select>";
echo "<input type='submit' value='OK'>";
echo "</form>";}*/
/**********************************/
//第6回宿題2
/*if(isset($_GET)){
$i = intval($_GET["btn"]);
echo $i . "を選びました";
echo "<input type='button' οnclick='history.back()' value='back'>";
}else{
echo "<h1>Create many buttons.</h1>" ;
echo "<form>";
for ($i = 1; $i <= 100; $i++) {
echo "<input type='submit' name='btn' value='{$i}'>"; }
}
echo "</form>";*/
/*********************************/
?>
</body>
</html>