php做网页登陆页面,传递数据,变量无效,求解
php总共设置了三个变量,判定时发现只有$select有效,其他两个无效,这是怎么回事呀?
求能手回答,赶任务,急
帮个忙,改改,不胜感激
登陆界面代码:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
<!--
.STYLE5 {font-size: 36px}
body {
background-image: url();
}
.STYLE6 {font-size: 18px}
-->
</style>
</head>
<body>
<table width="900" height="541" border="1" align="center">
<tr>
<td height="535" valign="top" bgcolor="#FFFFFF"><table width="900" height="106" border="1">
<tr>
<td width="210" height="100" valign="middle"><span class="STYLE5"><img src="20002.gif" width="209" height="107" /></span></td>
<td width="674" valign="middle"><span class="STYLE5">西南民族大学</span></td>
</tr>
</table>
<table width="900" border="1">
<tr>
<td align="center"><span class="STYLE5">实验教学管理系统</span></td>
</tr>
</table>
<table width="900" height="231" border="1">
<tr>
<td width="442" rowspan="4"> </td>
<td width="442"><span class="STYLE6">用户登录</span></td>
</tr>
<tr>
<td><form id="form1" name="form1" method="post" action="XXX.php">
用户
<label>
<input type="text" name="textfield" />
</label>
</form>
</td>
</tr>
<tr>
<td height="58"><form id="form2" name="form2" method="post" action="XXX.php">
密码
<label>
<input type="password" name="textfield2" />
</label>
</form>
</td>
</tr>
<tr>
<td height="55" align="right" valign="top"><form id="form3" name="form3" method="post" action="XXX.php">
<label>
<select name="select">
<option value="a">用户类型</option>
<option value="b">教师</option>
<option value="c">学生</option>
</select>
</label>
<label>
<input type="submit" name="Submit" value="登录" />
</label>
</form>
</td>
</tr>
</table>
</td>
</tr>
</table>
<p> </p>
<p> </p>
</body>
</html>
php检测代码:
<?php
@$textfield=$_POST['textfield'];
@$textfield2=$_POST['textfield2'];
@$select=$_POST['select'];
if(($textfield=="a")&&($textfield2=="123")&&($select=="b")) //输入a,123,选教师无效,去掉任意
echo "<p>fffffff</p>"; //条件,输入任意数据,发现($select=="b")是有效的,
else //其他两个语句无用,必为假。
header("Location: http://localhost/phpmyadmin/Documentation.html");
exit;
?> PHP 登陆界面问题
[解决办法]
你要写多少个form!!!
[解决办法]
一个form就ok了, 把第一个form留着,其他的都删掉就行了
就是这样
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
<!--
.STYLE5 {font-size: 36px}
body {
background-image: url();
}
.STYLE6 {font-size: 18px}
-->
</style>
</head>
<body>
<table width="900" height="541" border="1" align="center">
<tr>
<td height="535" valign="top" bgcolor="#FFFFFF"><table width="900" height="106" border="1">
<tr>
<td width="210" height="100" valign="middle"><span class="STYLE5"><img src="20002.gif" width="209" height="107" /></span></td>
<td width="674" valign="middle"><span class="STYLE5">西南民族大学</span></td>
</tr>
</table>
<table width="900" border="1">
<tr>
<td align="center"><span class="STYLE5">实验教学管理系统</span></td>
</tr>
</table>
<table width="900" height="231" border="1">
<tr>
<td width="442" rowspan="4"> </td>
<td width="442"><span class="STYLE6">用户登录</span></td>
</tr>
<tr>
<td><form id="form1" name="form1" method="post" action="XXX.php">
用户
<label>
<input type="text" name="textfield" />
</label>
</td>
</tr>
<tr>
<td height="58">
密码
<label>
<input type="password" name="textfield2" />
</label>
</td>
</tr>
<tr>
<td height="55" align="right" valign="top">
<label>
<select name="select">
<option value="a">用户类型</option>
<option value="b">教师</option>
<option value="c">学生</option>
</select>
</label>
<label>
<input type="submit" name="Submit" value="登录" />
</label>
</form>
</td>
</tr>
</table>
</td>
</tr>
</table>
<p> </p>
<p> </p>
</body>
</html>