我就是想通过点击index.php页面的“登陆”按钮。能够跳转至mainland.php页面,中间经过check.php用于对登陆用户和密码进行判断部分,如不成功返回到index这个页面
不知道这么说能不能说的详尽
再现等

解决方案 »

  1.   


    index.php
    <form name='xxx' method='post' action='check.php'>
    <input type='text' name='username' >
    <input type='password' name='password'>
    <input id='slogin' type='submit' name='submit' value='提交'>
    </form>check.php//mysql_connect();
    //mysql_select_db();
    $sql = "... ";
    $result = mysql_query($sql);
    if($row = mysql_fetch_array($result))
    {
    //比较密码
    if()
    {
      //正确
      header("location: xxx.php);
    }
    else 
    {
    //错误
      header("location: index.php);
    }
    }
    else 
    {
      //错误
      header("location: index.php);
    }
      

  2.   

    我想问一下,如果发生我上面出现的问题 一般是是什么原因造成的?
    代码如下
    <!--index(首页)-->
    <!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=gb2132" />
    <title>定额计算登陆界面</title>
    <script language="javascript">
    alert("user:"+ <?php $_POST["pdmuser"]?>);
    alert("usercode:"+ <?php $_POST["pdmuserpw"]?>);
    </script>
    </head><body bgcolor="#FFFFFF">
        <br><br><br><br><br><br><br>
        
    <form  action="check.php" method="post" target="middle">
    <table width="509" border="0" align="center" height="318">
            <tr align="center">
    <td height="65" colspan="2">
    <font face="幼圆" size="+2" color="#FF3300">
    定额计算系统
    </font>
    </td>
    </tr>
       

    <tr align="center" bgcolor="#FFCCCC">
    <td height="43" colspan="2">用户:
    <input type="text" name="pdmuser" id="pdmuser" >
    </td>
    </tr>
    <tr align="center" bgcolor="#FFCCCC">
    <td height="42" colspan="2">密码:
    <input type="password" name="pdmuserpw" id="pdmuserpw" >
    </td>
    </tr>
    <tr align="center" bgcolor="#CCCCFF">
    <td height="48" colspan="2">
    <input type="submit" name="submit"   value="登录">
    </td>
    </tr>
       
      </table>
      </form>
        
    </body>
    </html><?!--check.php--?>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>无标题文档</title>
    <script language="javascript">
    alert("user:"+ <?php $_POST["pdmuser"]?>);
    alert("usercode:"+ <?php $_POST["pdmuserpw"]?>);
    </script>
    </head>
    <body bgcolor="#EBEBEB">
    <?php $user     = $_POST["pdmuser"];
    $usercode = $_POST["pdmuserpw"];

    if(!$user)
    {
    echo "<small>未登录系统!<a href = index.php>返回登录界面</a></small>";
    exit;
    }

    //用户名大写转换
    $user = strtoupper($user);

    include 'include/pdmdblogon.php';


    $sql = "select USERLOGNAME from USERINFORMATION where USERLOGNAME = '$user' and PASSWORD = '$usercode'";
    $stmt = ociparse($conn,$sql);
    if(!$stmt)
    {
    echo "ERROR - Could not parse SQL statement.";
    exit;
    }
    ociexecute($stmt);
    $rightful = ocifetchinto($stmt,$row,OCI_ASSOC);
    if($rightful)
    {
    include 'mainland.php';
    }
    else
    {
    echo "<small>用户名或密码错误!</small>";
    }

    //断开PDM数据库
    include 'include/pdmdblogoff.php';?>
    </body>
    </html><?!--mainland.php?>
    <HTML>
    <HEAD>
    <TITLE>定额计算</TITLE>
    <META content="text/html; charset=gb2312" http-equiv=Content-Type>
    <META content="MSHTML 5.00.2614.3500" name=GENERATOR>
    </HEAD>
    <FRAMESET border=false cols="300,*" frameBorder=0 frameSpacing=0>
    <FRAME name=contents src="tree.php" target="right">
    <FRAME name=right src="display.php">
    <NOFRAMES>
    <body>
    </body>
    </NOFRAMES>
    </FRAMESET>
    </HTML>
      

  3.   

    看一下是否能获取$user的值不。。
    通过输出排除问题。
      

  4.   

    好像是不能 我想问一下 用什么代码来获取$user的值呢?
    我想问一下php中 有什么函数或是方法是用来获取系统变量的值的
    不吝赐教!
      

  5.   

    <form  action="check.php" method="post" target="middle"> 
    =>
    <form  action="check.php" method="post"> 
    另外check.php加上一行
    var_dump($_POST);
    看有没有传值过来
      

  6.   

    当单击“登陆”按钮时,并不能够发生页面跳转,我把你说的这句话放到了check.php中了,也没有什么提示信息!
    这种情况算不算是 post根本就没有把值传过来  还是可以算是说form有问题!
      

  7.   

    查看php.ini里面的register_long_arrays是否为on
      

  8.   

    我是用的dreamwear编写代码  您说得这个php。ini文件是不是在服务器上的一个文件?
      

  9.   

    请问还有没有别的可能性 对于_POSE不能传值这个问题
      

  10.   

    我刚才在check.php开始head之间加入了var_dump($_POST); 这条语句,为什么会显示出很多条呢?明明是一条记录,却在网页中出现若干条$_POST 的值,我只在登陆的时候输入了一个用户名和密码,为何会出现若干条呢?
    请大家帮忙指教一下!