星座判別

測試小品,星座判別

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>My facebook Test</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="post.php">
<p>星座</p>
<p>姓名:
<span id="username">
<input type="text" name="username" id="username" />
</span> </p>
<p>生日:
<label for="year"></label>
<select name="year" id="year">
<option value="1960" selected="selected">1960</option>
<option value="1961">1961</option>
<option value="1962">1962</option>
<option value="1963">1963</option>
<option value="1964">1964</option>
<option value="1965">1965</option>
<option value="1966">1966</option>
<option value="1967">1967</option>
<option value="1968">1968</option>
<option value="1969">1969</option>
<option value="1970">1970</option>
<option value="1971">1971</option>
<option value="1972">1972</option>
<option value="1973">1973</option>
<option value="1974">1974</option>
<option value="1975">1975</option>
<option value="1976">1976</option>
<option value="1977">1977</option>
<option value="1978">1978</option>
<option value="1979">1979</option>
<option value="1980">1980</option>
<option value="1981">1981</option>
<option value="1982">1982</option>
<option value="1983">1983</option>
<option value="1984">1984</option>
<option value="1985">1985</option>
<option value="1986">1986</option>
<option value="1987">1987</option>
<option value="1988">1988</option>
<option value="1989">1989</option>
<option value="1990">1990</option>
<option value="1991">1991</option>
<option value="1992">1992</option>
<option value="1993">1993</option>
<option value="1994">1994</option>
<option value="1995">1995</option>
<option value="1996">1996</option>
<option value="1997">1997</option>
<option value="1998">1998</option>
<option value="1999">1999</option>
<option value="2000">2000</option>
<option value="2001">2001</option>
<option value="2002">2002</option>
<option value="2003">2003</option>
<option value="2004">2004</option>
<option value="2005">2005</option>
<option value="2006">2006</option>
<option value="2007">2007</option>
<option value="2008">2008</option>
<option value="2009">2009</option>
<option value="2010">2010</option>
<option value="2011">2011</option>
</select>
年
<label for="month"></label>
<select name="month" id="month">
<option value="01" selected="selected">01</option>
<option value="02">02</option>
<option value="03">03</option>
<option value="04">04</option>
<option value="05">05</option>
<option value="06">06</option>
<option value="07">07</option>
<option value="08">08</option>
<option value="09">09</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
</select>
月
<label for="day"></label>
<select name="day" id="day">
<option value="01" selected="selected">01</option>
<option value="02">02</option>
<option value="03">03</option>
<option value="04">04</option>
<option value="05">05</option>
<option value="06">06</option>
<option value="07">07</option>
<option value="08">08</option>
<option value="09">09</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
<option value="27">27</option>
<option value="28">28</option>
<option value="29">29</option>
<option value="30">30</option>
<option value="31">31</option>
</select>
日</p>
<p>&nbsp;</p>
<p>
<input type="submit" name="button" id="button" value="Submit" />
<input type="reset" name="button2" id="button2" value="Reset" />
</p>
</form>
<br /><br />
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>
<body>
<?
$name = $_POST['username'];
$year = $_POST['year'];
$year = ($year)%4 ;
$mon = $_POST['month'];
$day = $_POST['day'];
echo "星座測試: <br />";
echo"姓名:";
if ($name == NULL)
{echo  "您沒有輸入名字 <br />";
}
else{echo $name."<br />";}
switch ($mon)
{
case '01':
if ($day >= 21){echo "水瓶";}else{ echo"魔羯";}
break;
case '02':
if (($year != 0 ) and ($day >=29)){echo "非閏年只有到 28 號";}
elseif(($year != 0) and ($day <=19)){echo "天瓶";}
elseif(($s_year == 0) and ($day >=30)){echo "閏年最多到 29 號";}
else{echo "雙魚";}
//if ($day >= 29 ){echo "日期錯誤";}elseif ($day <= 19){echo "水瓶";}else{ echo "雙魚";}
break;
case '03':
if ($day >= 21){echo "白羊";}else{ echo "雙魚";}
break;
case '04':
if ($day <=19){echo "白羊";}elseif($day == 31){echo "4月份沒有31";}else{ echo "金牛";}
break;
case '05':
if ($day <= 20){echo "金牛";}else{ echo "雙子";}
break;
case '06':
if ($day <= 21){echo "雙子";}else{ echo "巨蟹";}
break;
case '07':
if ($day <= 22){echo "巨蟹";}else{ echo "獅子";}
break;
case '08':
if ($day <= 22){echo "獅子";}else{ echo "處女";}
break;
case '09':
if ($day <= 22){echo "處女";}else{ echo "天瓶";}
break;
case '10':
if ($day <= 23){echo "天瓶";}else{ echo "天蠍";}
break;
case '11':
if ($day <= 21){echo "天蠍";}else{echo "射手";}
break;
case '12':
if ($dat <= 20){echo "射手";}else{echo "魔羯";}
break;
default ;
echo "錯誤";
}
echo "<br />Birthday:".$_POST['year']."/".$mon."/".$day." <br />";
?>
</body>
</html>