<html><head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<meta name="author" content=""><title>Untitled 2</title>
</head>
<body>
<form action="res.php" method="post"><input type="text" id="txt_fname">
<input type="submit" value="query">
</form>
</body></html>

解决方案 »

  1.   

    <input type="text" id="txt_fname">改为<input type="text" name="txt_fname">
      

  2.   

    id="txt_fname"   $_POST 用name值,不是用ID
      

  3.   

    是啊.你得加name不然得不到值的.
      

  4.   

    哦,我以前学的是asp/asp.net,所以不知道。晚上试试,多谢各位了。
      

  5.   

    该动如下:
    index.php:<html><head>
    <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
    <meta name="author" content=""><title>Untitled 2</title>
    </head>
    <body>
    <!--------------------------------------->
    <form action="res.php" method="post">
    <input type="text"  name="txt_fname">
    <input type="submit" value="query"></body>
    </form>
    </html>res.php:接收表单
    <?php
    //$name=$HTTP_POST_VARS["txt_fname"];
    $name=$_POST['txt_fname'];
    echo $name;
    ?>
      

  6.   

    改动如下:
    index.php:<html><head>
    <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
    <meta name="author" content=""><title>Untitled 2</title>
    </head>
    <body>
    <!--------------------------------------->
    <form action="res.php" method="post">
    <input type="text" name="txt_fname">
    <input type="submit" value="query">
    </form>
    </body>
    </html>res.php:接收表单
    <?php
    //$name=$HTTP_POST_VARS["txt_fname"];
    $name=$_POST['txt_fname'];
    echo $name;
    ?>
    ------------------------------------
    不好意思,时间紧急,不知道行不行?
      

  7.   

    <input type="text" id="txt_fname">改为<input type="text" name="txt_fname">
      

  8.   


    我试了试不能提交的原因是因为name中不能有下划线即改为<input   type="text"   name="txtfname" >$name=$_POST[ "txtfname "]; 
    print($name);
    即可
      

  9.   

    问题已经解决了,看来php和asp.net还是有很大差距的。结帖了。感谢大家对此问题的关注。