if ($_POST["act"]=="login"){
$db_link=mysql_connect("localhost","root","db123456");
$db_sel=mysql_select_db("class");
$str_sel="SELECT * FROM `tblmen` WHERE `gra`= '".$_POST["gra"]."' AND 'cla'='".$POST["cla"]."' AND 'snum'='".$POST["snum"]."' AND `pwd`='".$_POST["pwd"]."'";
echo "$str_sel";
$result=mysql_query($str_sel);
$data_cnt=mysql_num_rows($result);
if ($data_cnt==1){
header("Location:list.php");
}else{
header("Location:index.php");
}
}
?>
<!DOCTYPE html>
<html>
<head></head>
<body>
<h1 align="center">會員登入</h1>
<form action="" method="post" name="formAdd">
<table align="center">
<tr>
<td>年級</td>
<td>
<select name="gra">
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
</select>
</td>
</tr>
<tr>
<td>班級</td>
<td>
<select name="cla">
<option value="01">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>
</select>
</td>
</tr>
<tr>
<td>座號</td>
<td>
<select name="snum">
<option value="01">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>
</select>
</td>
</tr>
<tr><td>密碼</td><td><input type="text" name="pwd"></td></tr>
<tr><td></td><td>
<input type="hidden" value="login" name="act">
<input type="submit" value="登入" name="ok">
</td></tr>
</table>
</form>
</body>
</html>
沒有留言:
張貼留言