开发者

Using php and POST on a form, but request_method says it is a GET

So I have this form that I am submitting to a php script that echos $_SERVER['REQUEST_METHOD']. I do not know why, but even though I specify the POST method in the form, it always echoes GET. Why is this? What am I doing wrong?

<form action="location.php" method="POST">
<table>
    <tr>
        <td>name</td>
        <td><input type="text" name="name"></td>
    </tr>
    <tr>
        <td>address</td>
        <td><input type="text" name="address"></td>
    </tr>
    <tr>
        <td>lat</td>
        <td><input type="text" name="lat"></td>
    </tr>
    <tr>
        <td>lng</td>
        <td><input type="text" name="lng"></td>
    </tr>
    <tr>
        <td>user</td>
        <td><input type="text" name="user"><开发者_如何学C/td>
    </tr>
    <tr>
        <td>type</td>
        <td><input type="text" name="type"></td>
    </tr>
    <tr>
        <td>method</td>
        <td><input type="text" name="methoda"></td>
    </tr>
    <tr>

        <td><input type="submit" name="submit"></td>
    </tr>
 </table>
</form>


as I have spent countless hours trying to fix a bug related to the "REQUST_METHOD" being wrong in PHP and not finding anything helpful online, this is my report on the issue: Chrome seems to have a bug in the Version 30.0.1599.101

my jquery test code was:

$.ajax({
  type: "POST",
  url: '../Server/test.php',
  data: {data:"data"}
});
$.ajax({
  type: "PUT",
  url: '../Server/test.php',
  data: {data:"data"}
});
$.ajax({
  type: "GET",
  url: '../Server/test.php',
  data: {data:"data"}
});

php:

<?
echo $_SERVER['REQUEST_METHOD'];
?>

in Chrome the response was PUT, PUT, GET in Opera as expected POST, PUT, GET

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜