<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Aufgabe 9</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<h1>Wochentag</h1>
<form name="form1" method="get" action="ex8.php">
<table width="400px" border="0" bgcolor="#99FFFF">
<tr>
<td width="150px">Tag:</td>
<td width="250px">
<select name="cbJour">
<?php
$ancien = $_GET["cbJour"];
for ($i = 1; $i <= 31; $i++) {
if ($i == $ancien) $s = " selected";
else $s = "";
echo "<option value=\"$i\"$s>$i</option>";
}
?>
</select>
</td>
</tr>
<tr>
<td>Monat:</td>
<td>
<select name="cbMois">
<?php
$ancien = $_GET["cbMois"];
for ($i = 1; $i < 13; $i++) {
if ($i == $ancien) $s = " selected";
else $s = "";
echo "<option value=\"$i\"$s>";
switch ($i) {
case 1:echo "janvier";break;
case 2:echo "février";break;
case 3:echo "mars";break;
case 4:echo "avril";break;
case 5:echo "mai";break;
case 6:echo "juin";break;
case 7:echo "juillet";break;
case 8:echo "août";break;
case 9:echo "septembre";break;
case 10:echo "octobre";break;
case 11:echo "novembre";break;
case 12:echo "décembre";
} // switch
echo "</option>";
} // for
?>
</select>
</td>
</tr>
<tr>
<td>Jahr :</td>
<td>
<input name="txtAnnee" type="text" value="<?php echo
$_GET['txtAnnee']; ?>" size="10" maxlength="4">
</td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td>
<input type="submit" name="Submit" value="Wochentag">
</td>
<td>
<?php
$a = $_GET["txtAnnee"];
$m = $_GET["cbMois"];
$j = $_GET["cbJour"];
// Ist dies der erste Aufruf der Seite?
if (isset($a)) {
echo "Der $j.$m.$a ist ein ";
$js = jddayofweek(cal_to_jd(CAL_GREGORIAN,$m,$j,$a),0);
switch ($js) {
case 0:echo "Sonntag";break;
case 1:echo "Montag";break;
case 2:echo "Dienstag";break;
case 3:echo "Mittwoch";break;
case 4:echo "Donnerstag";break;
case 5:echo "Freitag";break;
case 6:echo "Samstag";
} // switch
} // if isset
?>
</td>
</tr>
</table>
</form>
<p> </p>
</body>
</html>