看你的 <INPUT 是不写得不规范。

解决方案 »

  1.   

    关注!我也遇到这种问题了,关键字查询的时候,回车没有反应,点按钮却可以正确实现的.
    <form name="search" method="post" action="search.php">
    ...
                <input type="text" name="keyword" class="textarea1" size="16">
    ...
              <input type="submit" name="search" value="搜索" class="textarea1">
    ....        
    </form>
    PHP代码为:
    if($search){
    $PageSize=12;

    $StrSql="select * from comm_introduce where calibre like \"%".$keyword."%\"";
    ......
    }
      

  2.   

    楼上的是不是因为第二个input中class的原因?
      

  3.   

    楼主是不是说文本框中定义value=abc,点提交按纽时得到的值是abc,回车提交得到的值是abcvalue=abc?
    <form name="form1" method="post" action="">
      <input type="text" name="test" value="abc">
      <input type="submit" name="Submit" value="提交">
    </form><?php
    echo $_POST['test'];
    ?>
      

  4.   

    请去掉input 中name前type得引号
      

  5.   

    在我这里测试都没有这种情况,你每次触发的时候,echo值出来看看,就好解决一点.
      

  6.   

    完整的代码如下:
    login.php
    <html>
    <head>
          <title></title>
    </head>
    <body>
          <form action="data_transfer.php" method="post">
           <table>
           <tr><td>login name :</td>
           <td><input type="text" size="20" name="login_name" value="<? echo $login_name; ?>"></td></tr>
           <tr><td><input type="submit" size="5" name="send" value="login"></td><td></td><tr>
           </table>
           </form>
    </body>
    </html>
    ------------------------------------------------------
    data_transfer.php
    <?
    $id = fopen("data.txt", "w");
    $string = $HTTP_POST_VARS['login_name'];
    fputs($id , $string);
    echo "string:".$string."<br>";
    echo "login_name:".$login_name."<br>";
    echo "file:".fgets($id, 256)."<br>";
    fclose($id);
    ?>
    运行程序,在login.php中输入test按回车键后data_transfer.php得到的输出是
    string: testlogin_name=test
    login_name: testlogin_name=test
    file: 
    写入data.txt的数据是testlogin_name=test
    但若用鼠标点击login按钮data_transfer.php得到的输出是
    string: test
    login_name: test
    file:
    写入data.txt的数据是test