日期:2014-05-17  浏览次数:20502 次

在注册用户时用两个条件限制
我设计了一个教师注册信息的功能。教师需输入与数据库中对应的姓名和职工号才可注册成功,问题是,如果我只限制与数据库中的姓名相对应便可注册的话,就可以正常注册,如果我限制姓名和职工号两个条件的话,即使我输入正确的姓名和职工号,系统也执行“你输入的信息有误,不属于计算机学院教师”这句。是不是我写的语句有问题?这是我的前台
<!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=GB2312" />
<title>教师注册页面</title>
<style type="text/css">
<!--
.STYLE1 {
font-size: 14px;
color: #FF0000;
}
.STYLE2 {color: #FF0000}
.STYLE3 {font-size: 14px}
.STYLE4 {font-size: 14px; color: #000000; }
.STYLE5 {font-size: 12px}
-->
</style>
</head>

<body>
<?php 
//######################教师注册##########################
  include "conn.php";
  include "header.php";?>
 <p>
</p>
<table width="500" border="1" align="center" cellpadding="0" cellspacing="1"  class="text">
  <!--DWLayoutTable-->
  <form name="form1" method="post" action="teacher_register1.php">
    <tr bgcolor="#CDE6C7"> 
      <td height="27" colspan="3"><span class="STYLE1 STYLE2 STYLE1">--->教师注册</span></td>
    </tr>
<tr> 
      <td width="148" bgcolor="#FFFFFF"><div align="center" class="STYLE4">
        <div align="right">姓名:</div>
      </div></td>
      <td width="443" bgcolor="#FFFFFF" height="41"> <input type="text" name="name" size="25">
      &nbsp;&nbsp;<span class="STYLE5">*请输入您的真实姓名 </span></td>
    </tr>
<tr> 
      <td width="148" bgcolor="#FFFFFF"><div align="center" class="STYLE4">
        <div align="right">职工号:</div>
      </div></td>
      <td width="443" bgcolor="#FFFFFF" height="41"> <input type="text" name="staffno" size="25">
      &nbsp;&nbsp;<span class="STYLE5">*请输入您的职工号 </span></td>
    </tr>
<tr> 
      <td width="148" bgcolor="#CDE6C7"><div align="center" class="STYLE2">
        <div align="right" class="STYLE4">密码:</div>
      </div></td>
      <td width="443" bgcolor="#CDE6C7" height="41"> <input type="password" name="password" size="25">
      &nbsp;&nbsp;<span class="STYLE5">*输入密码,长度为3-16位  </span></td>
    </tr>
<tr> 
      <td width="148"&nb