表单使用get而不是post

时间:2013-05-09 00:05:26

标签: php html post get

在我的PHP中,我有......

<?php
if(isset($_POST['username'])){
//do stuff
}
?>

它没有在里面执行什么因为表单没有设置。这是我的HTML ...(这是一个PHP回声,所以我设置了转义字符)

<form class=\"form-vertical\" action=\"./index.php\" method=\"post\">
                <p>Enter username and password to continue.</p>
                <div class=\"control-group\">
                    <div class=\"controls\">
                        <div class=\"input-prepend\">
                            <span class=\"add-on\"><i class=\"icon-user\"></i></span><input type=\"text\" name=\"username\" placeholder=\"Username\" />
                        </div>
                    </div>
                </div>
                <div class=\"control-group\">
                    <div class=\"controls\">
                        <div class=\"input-prepend\">
                            <span class=\"add-on\"><i class=\"icon-lock\"></i></span><input type=\"password\" name=\"password\" placeholder=\"Password\" />
                        </div>
                    </div>
                </div>
                <div class=\"form-actions\">
                    <span class=\"pull-left\"><a href=\"#\" class=\"flip-link\" id=\"to-recover\">Lost password?</a></span>
                    <span class=\"pull-left\" style=\"padding-left: 20px;\"><a href=\"\" class=\"flip-link\" id=\"to-register\">Register</a></span>
                    <span class=\"pull-right\"><input type=\"submit\" class=\"btn btn-inverse\" value=\"Login\" /></span>
                </div>
            </form>

在我的网址中使用GET(index.php?username = blah&amp; password = blah)

1 个答案:

答案 0 :(得分:0)

如果您使用$ _REQUEST IN还没有$ _GET或发布它将从它在post,get,cookie和会话变量中找到的第一个中提取它。

相关问题