PHP无法读取文本框值

时间:2013-11-14 18:01:53

标签: php html

我正在为课程创建一个基本网站,在我的登录html页面上,我有2个文本框用户名和密码以及一个登录按钮。在提交我调用php文件。它读取txt_Username但不读取txt_Password。您是否必须以不同方式阅读密码文本框?

提前致谢。

HTML网页代码;

</div>
<div id="Content">
 <form id="loginForm" name="loginForm" method="GET" action="Login.php">
  <table width="27%" border="0" align="center">
  <tr>
  <td width="42%">Username:</td>
      <td width="58%"><input type="text" name="txt_Username" id="txt_Username" /></td>
    </tr>
    <tr>
      <td width="42%">Password:</td>
      <td width="58%"><input type="password" name="txt_Password" id="txt_Password" />    </td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td><input type="submit" name="btn_validate" id="btn_validate" value="Login" /></td>
    </tr>
    <tr>

  </table>
  <p>&nbsp;</p>
</form>
</div>  

PHP代码;

<?php
   session_start();

$server = "host.com";
$schema = "Seatter";
$uid = "user";
$pwd = "password";

    $password =$_GET["txt_Password"];
    $username =$_GET["txt_Username"];


    mysql_connect($server , $uid , $pwd) or die ("server not found");
    mysql_select_db($schema) or die ("Database not found");

    $sql = "SELECT *
    FROM Login_Details
    WHERE User_ID = '$username' AND  Password = '$password'";
$record = mysql_query($sql) ;

    if(mysql_num_rows($record) == 0){

         echo "Login Failure: ";
     //echo $username; //Username read from html page
     echo $password; //Password not read.
     //header("location: Login.html");  
    }

mysql_close();

?>  

0 个答案:

没有答案