代码如下,使用get能获取到表单数据,而post获取不到表单数据,搜了好多帖子没解决问题求大神们给小白解惑啊!

解决方案 »

  1.   

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
    </head>
    <body><form action="" method="post">
    姓名:<input type="text" name="name" value="<?php echo $_POST['name']?>"/>
        <input type="submit" value="提交"/>
    </form></body>
    </html><?php
    echo '<pre>';
    var_dump($_POST);
    echo '</pre>';
    ?>注意事项:
                1、form 中 methed属性
                2、form 中 action 文件路径 ps:当前文件可不写
      

  2.   

    3. form 中 method 不是 methed
      

  3.   

    1中的method改了,还是有问题,两个文件都是notepad++写的,写了之后都放在wampsever的运行环境www目录下面的
      

  4.   

    还有在当前文件试过,也是get可以拿到表单的数据,而post就拿不到
    都是在notepad++写的文件,以后放到wamp/www目录下运行的,
      

  5.   

    <html><meta charset="utf-8"><head><title color="red">调查问卷</title> </head><body><form name="form1" method="post" action="5.1.1.php"/>姓名:<input type="text" name="name" value="xingming"/></br>性别:<input  type="radio" name="sex" value="男" checked />男      <input  type="radio" name="sex" value="女"/>女</br>你的爱好:</br><input type="checkbox" name="ah1" value="sang"/>唱歌</br><input type="checkbox" name="ah2"value="dance"/>跳舞</br><input type="checkbox" name="ah3" value="drink"/>喝酒</br><input type="checkbox" name="ah4" value="play"/>玩耍</br>请输入你的详细介绍:</br><textarea name="xxjs" cols="50" rows="5"/></textarea></br></br><input name="submit" type="submit" value="提交" align="center"/><input type="reset" value="重写" align="center"/></form></body></html>
      

  6.   

    <html>
    <meta charset="utf-8">
    <head>
    <title>
    接受调查问卷
    </title>
    <body>
    <?php echo $_POST["name"];
    echo "你的性别是".$_GET["sex"];
    ?> </body>
    </head>
    </html>
      

  7.   

    你看一下代码    ,谢谢<html>
    <head>
        <meta charset="utf-8" />
        <title color="red">调查问卷</title>
    </head>
    <body>
    <form name="form1" method="post" action="">
        姓名:
        <input type="text" name="name" value="xingming" />
        <br /> 性别:
        <input type="radio" name="sex" value="男" checked="" />男
        <input type="radio" name="sex" value="女" />女
        <br /> 你的爱好:
        <br />
        <input type="checkbox" name="ah1" value="sang" />唱歌
        <br />
        <input type="checkbox" name="ah2" value="dance" />跳舞
        <br />
        <input type="checkbox" name="ah3" value="drink" />喝酒
        <br />
        <input type="checkbox" name="ah4" value="play" />玩耍
        <br />请输入你的详细介绍:
        <br />
        <textarea name="xxjs" cols="50" rows="5"></textarea>
        <br />
        <br />
        <input type="submit" value="提交" align="center" />
        <input type="reset" value="重写" align="center" />
    </form>
    </body>
    </html>
    <?php
    echo '<pre>';
    var_dump($_POST);
    echo '</pre>';
    ?>新建一个.php文件 将代码放进入运行  如果出错把结果截图出来
      

  8.   

    你看一下代码    ,谢谢<html>
    <head>
        <meta charset="utf-8" />
        <title color="red">调查问卷</title>
    </head>
    <body>
    <form name="form1" method="post" action="">
        姓名:
        <input type="text" name="name" value="xingming" />
        <br /> 性别:
        <input type="radio" name="sex" value="男" checked="" />男
        <input type="radio" name="sex" value="女" />女
        <br /> 你的爱好:
        <br />
        <input type="checkbox" name="ah1" value="sang" />唱歌
        <br />
        <input type="checkbox" name="ah2" value="dance" />跳舞
        <br />
        <input type="checkbox" name="ah3" value="drink" />喝酒
        <br />
        <input type="checkbox" name="ah4" value="play" />玩耍
        <br />请输入你的详细介绍:
        <br />
        <textarea name="xxjs" cols="50" rows="5"></textarea>
        <br />
        <br />
        <input type="submit" value="提交" align="center" />
        <input type="reset" value="重写" align="center" />
    </form>
    </body>
    </html>
    <?php
    echo '<pre>';
    var_dump($_POST);
    echo '</pre>';
    ?>新建一个.php文件 将代码放进入运行  如果出错把结果截图出来
    没有报错了,下面用php输出的内容是
    array (size=3)
      'name' => string 'xingming' (length=8)
      'sex' => string '男' (length=3)
      'xxjs' => string '' (length=0)
      

  9.   

    你看一下代码    ,谢谢<html>
    <head>
        <meta charset="utf-8" />
        <title color="red">调查问卷</title>
    </head>
    <body>
    <form name="form1" method="post" action="">
        姓名:
        <input type="text" name="name" value="xingming" />
        <br /> 性别:
        <input type="radio" name="sex" value="男" checked="" />男
        <input type="radio" name="sex" value="女" />女
        <br /> 你的爱好:
        <br />
        <input type="checkbox" name="ah1" value="sang" />唱歌
        <br />
        <input type="checkbox" name="ah2" value="dance" />跳舞
        <br />
        <input type="checkbox" name="ah3" value="drink" />喝酒
        <br />
        <input type="checkbox" name="ah4" value="play" />玩耍
        <br />请输入你的详细介绍:
        <br />
        <textarea name="xxjs" cols="50" rows="5"></textarea>
        <br />
        <br />
        <input type="submit" value="提交" align="center" />
        <input type="reset" value="重写" align="center" />
    </form>
    </body>
    </html>
    <?php
    echo '<pre>';
    var_dump($_POST);
    echo '</pre>';
    ?>新建一个.php文件 将代码放进入运行  如果出错把结果截图出来
    没有报错了,下面用php输出的内容是
    array (size=3)
      'name' => string 'xingming' (length=8)
      'sex' => string '男' (length=3)
      'xxjs' => string '' (length=0)
      

  10.   

    这些数据就是POST的数据