简体   繁体   中英

Browser sends HTTP POST requests as GET requests

I have a PHP Application which is written using CodeIgniter. I am facing a strange problem regarding HTTP requests. I noticed that the chrome developer tool shows the results of the HTTP request methods as 404 Not found but I can receive the response from the application. Also another problem and my main problem is that the HTTP post requests are being sent as GET requests, however they are sent as GET methods. Here is the HTML form which sends the request:

<form name="form" id="form" action="login" class="form-horizontal" method="POST">
    //                          
</form>

And if I debug the request by printing the value of $_SERVER variable I can see that the request method is GET :

'SERVER_PROTOCOL' => string 'HTTP/1.1' (length=8)
'REQUEST_METHOD' => string 'GET' (length=3)
'QUERY_STRING' => string '' (length=0)

And also there are these two more options that I don't know what they mean:

'REDIRECT_REQUEST_METHOD' => string 'POST' (length=4)
'REDIRECT_STATUS' => string '404' (length=3)

I am using Wamp on Windows 8.1 and CodeIgniter.

<form action="<?php echo base_url()?>index.php/login/function_name" method="post">
    <input  type="text" name="name"> 
    <input  type="email" name="email" > 
   <input  type="submit" name="submit" value="Submit" > //Important, this only submit the form 
</form

In login controller

public function function_name()
    {
        $name= $_POST['name']
        $email= $_POST['email']

        echo 'Name is :'.$name. 'and E-mail is : '.$email;
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM