表单发送GET而不是POST [英] Form sends GET instead of POST
问题描述
我已经搜索了所有标题相似的问题,但还没有解决方案.
I have searched the all questions with similar title, no solution for me yet.
我有一个在apache2上运行的网站.我需要通过表单提交敏感信息,并且需要使用POST方法.代替POST,它发送GET请求.
I have a website running on apache2. I need to submit sensitive information through a form and I need to use POST method. Instead of POST, it sends GET request.
HTML:
<form action="/add_user.php" method='POST'>
Enter Username: <input type="email" name="email" required="required" /> <br/>
Enter password: <input type="password" name="password" required="required" /> <br/>
<input type="submit" value="submit"/>
</form>
PHP:
<?php
$email=$_POST['email'];
$password=$_POST['password'];
//do stuff
?>
我已经在Firefox中打开了网络监视器,并且该方法被确认为GET.我什至试图使其成为PUT而不是POST,但它仍然发送GET.另外,如果我将其更改为$_GET
而不是$_POST
,则$email
和$password
会获取值.
I have opened Network monitor in Firefox, and the method is confirmed as GET. I have tried to even make it PUT instead of POST, still it sends GET. Also, $email
and $password
get the values if I change them to $_GET
instead of $_POST
.
任何帮助将不胜感激.
推荐答案
解决此问题的一种方法是通过以下方法来增强您的意图:
One way to solve this is to reinforce your intentions by this:
<button type="submit" formmethod="post" formaction="add_user.php">Submit</button>
这篇关于表单发送GET而不是POST的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!