echo("<meta http-equiv=refresh content=0;url=student.php?cno=$_POST[id]>");
这是前一个页面传递cno的值
echo $_GET[cno];
if($_POST[go])
{
echo $_GET[cno];
}
这是后一个页面的操作,但是echo $_GET[cno];能执行,打印出123456,if后面的那个竟然打印不出来
ps:$_POST[go]是一个submit的按钮,按下的话显示,请各位帮帮忙

解决方案 »

  1.   

    显然是$_POST[go]这个问题 
    var_dump($_POST[go]);//打印一下
      

  2.   

    if($_POST[go])
    {
    var_dump($_POST[go]);
    }
    打印的结果是
    string(2) "go"
      

  3.   

    你写代码是不是头大了啊,这很明显的错啊,你从上一页面中用echo("<meta http-equiv=refresh content=0;url=student.php?cno=$_POST[id]>");把值传递过来后只有$_GET[cno];
    而你if($_POST[go])
    {
    echo $_GET[cno];
    }
    中的$_POST[go]是怎么来的,你在这个页面中又没有表单提交的值。
      
      写程序一定 头脑清醒。
      

  4.   

    怎么回事啊,太诡异了,if后面那个$_GET死活搞不出来,我把它赋给一个$temp,到了if里面还是打印不出来
      

  5.   

    没有啊,go这个按钮是第二个页面一个表单:
    <form action="student.php" method="post">
    <input name="go" type="submit" value="go"/>
      

  6.   

    第二个页面就是student,我把它传回给自己
      

  7.   

    刚才“ps:$_POST[go]是一个submit的按钮,按下的话显示,请各位帮帮忙 ”这句没看到。其实如果有这样的话,建议你不要这样操作,因为POST值只在echo("<meta http-equiv=refresh content=0;url=student.php?cno=$_POST[id]>")这代码所在页面。而在student.php页面只有$_GET[cno];
    ,你如果想要提交时的POST值,你可以把go也写在地址中通过参数传递
      

  8.   

    <body>
    <?php
    if($_POST[id]!=0)
    {
     $sql=mysql_connect("localhost:3306","root","820511056");
     mysql_select_db("library",$sql);
     $id="'".$_POST[id]."'";
     $password="'".$_POST[password]."'";
     $s="select * from card where cno = ".$id;
     $result=mysql_query($s,$sql);
         if(mysql_fetch_row($result)==0)
     {
      echo "WRONG ID!";
     }
     else
     {
            echo("<meta http-equiv=refresh content=0;url=ddd.php?cno=$_POST[id]>");
     }
     mysql_close($sql);
    }
    ?>
    <form action="temp3.php" method="post">
      <div align="center">学生(老师)登陆<br /><br />
      借书证卡号:
        <input type ="text" name="id" size="20"/>
        <br/>
        <br />
    <input type="submit" name="submit" value="login in" />
      </div>
    </form>
    </body>
    </html>
    这是第一个页面的代码
    <body>
    <?php
            echo $_GET[cno];
    if($_POST[go])
    {
    var_dump($_POST[go]);
    var_dump($_GET[cno]);
    }
    ?>
    <form action="ddd.php" method="post">
    <input name="go" type="submit" value="go"/>
    </form>
    </body>
    </html>
    这是第二个的
      

  9.   

    打印的结果是:
    123456(cno的值)
    string(2)“go” NULL
    就是说前后的值不一样
      

  10.   

    我测试了下代码 
    <form action="ddd.php" method="post">
    <input name="go" type="submit" value="go"/>是向ddd.php 你可以看看点完go按钮以后 地址栏的地址 就明白了
      

  11.   

    谢谢,明白了!cno的值没有提交,谢谢了