表单提交后,$ _ POST为空 [英] $_POST is empty after form submit

查看:84
本文介绍了表单提交后,$ _ POST为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Twitter Bootstrap构建Web应用程序.我有一个表单,用户应在其中输入他的名字和姓氏,然后单击提交.问题是$_POST返回为空. 我在Windows 8计算机上使用WAMP.

I am using Twitter Bootstrap to build a web application. I have a form where user should enter his name and last name and click submit. The problem is, that the $_POST comes back empty. I am using WAMP on Windows 8 machine.

<?php
if(isset($_POST["send"])) {
    print_r($_POST)
} else {
    ?>
    <form class="form-horizontal" action="" method="post">
        <div class="control-group"> <!-- Firstname -->
            <label class="control-label" for="inputEmail">First name</label>
            <div class="controls">
                <input type="text" id="inputName" placeholder="First name">
            </div>
        </div>
        <div class="control-group"> <!-- Lastname -->
            <label class="control-label" for="inputEmail">last name</label>
            <div class="controls">
                <input type="text" id="inputLastname" placeholder="Last name">
            </div>
        </div>
        <div class="form-actions">
            <button type="submit" name="send" class="btn btn-primary">Submit data</button>
            <a href="<?php $mywebpage->goback(); ?>" class="btn">Cancel</a>
        </div>
    </form>
    <?php
}
?>

预先感谢

推荐答案

请尝试为输入类型添加名称,例如

Plz try and add names to the input types like

<input type="text" id="inputLastname" name="inputLastname" placeholder="Last name">

现在检查$ _POST变量.

Now check the $_POST variable.

这篇关于表单提交后,$ _ POST为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆