I create a form using post method like that :
<form name="indexFormn" id="indexForm" method="POST" action="page.php">
<div class="AdminformDiv">
<div class="errorbox">
<?php
if (!is_array($this->actionErrors)) {
echo $this->actionErrors;
}
?>
</div>
<div>
<table border="0" cellpadding="0" cellspacing="0" style="width:700px">
<tbody>
<tr>
<td style="width:128px">Amount</td>
<td colspan="2">$ <?php echo $this->price;?> USD<td style="width:270px"> </td>
</tr>
<tr>
.....
but the problem is when I do "var_dump($_SERVER['REQUEST_METHOD']);" in my php code I get all time "GET" not "POST" and really I don't know why?
I just had this problem using Codeigniter's MVC Framework. Here's what I discovered:
My Action attribute in my form did not include the "www" in front of my domain, but my actual URL needed the "www".
i.e. my form had action="https://mydomain/something"
but if I went to that URL, I noticed my web host added the www to the beginning: https://www.mydomain/something
. (I use DreamHost and it's a setting that I had picked)
I hope this is your issue as well - really frustrating to try and figure out, but once I got my action and actual URL to agree on the "www", my request method went from GET to POST.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With