php echo无法正常工作

时间:2012-12-07 16:53:41

标签: php html forms echo html-form-post

基本上,我想在html中创建一个简单的表单,我想输出所有用户输入一旦点击提交使用PHP。到目前为止它只是显示我输入的细节,但它没有得到用户的数据来回应它们。这是我的两个文件

output.php:

<?php 
echo 'Name: '.$POST["name"].'<br /> Gender: '.$POST["gender"].'<br />Country: '.$POST["country"];
?>

testingformphp.html(表单部分):

    <form id="form" name="form" method="post" action="./PHP/output.php"/>
    Name<input name="name" type="text" id="name"/><br/>

    Gender<label><input type="radio" name="gender" id="gender_0" value="male"/>Male</label><br/>
    <label><input type="radio" name="gender" id="gender_1" value="female"/>Female</label><br/>

<select name="country" id="select">
    <optgroup title="europe">
    <option value="Russia">Russia</option>
    <option value="Greece">Greece</option>


    </optgroup>

    </select>


    <input type="submit" id="button" value="Submit"/>
    <input type="reset" id="reset" value="Reset"/>

    </form>

有人可以帮忙吗?

2 个答案:

答案 0 :(得分:6)

$ POST不存在,请尝试$ _POST。

答案 1 :(得分:0)

<?php 
echo 'Name: '.$_POST["name"].'<br /> Gender: '.$_POST["gender"].'<br />Country: '.$_POST["country"];
?>

http://www.tizag.com/phpT/postget.php要查看帖子和获取方法。

相关问题