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?
Basically most HTTP requests are GET requests. and $_SERVER['REQUEST_METHOD'] evaluates default GET method.
you can use if($_POST) to check if it's a POST. (That's the array with POST data in it. All pages have $_GET set, so if($_GET) won't work to tell if it's a GET)
when you submit your form then you will sure get POST method on "page.php".
try to get method on this page and found.
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.