http request method == GET regardless of the form's setting?
Posted: Thu Feb 17, 2011 10:15 am
My web form requires the POST method because of large amount of data. I have found that the POST doesn't work in CMSMS as one would expect.
There are two pages to demonstrate the issue.
The page test-post1 content is the form itself and the method is specified as POST:
The page test-post2, which is the action for the form, displays the actual method of the http request, GET and POST arrays and the value from the :
The output from test-post2 is:
It is expected that echoing $_SERVER['REQUEST_METHOD'] would result to POST but it is GET in the sample. The value of variable t1 in undefined. When I change the form's method to GET everything works.
What makes the change of the http request method? Is it the engine of CMSMS?
Thank you.
There are two pages to demonstrate the issue.
The page test-post1 content is the form itself and the method is specified as POST:
Code: Select all
<form action="test-post2" method="post" name="my_test" id="my_test">
<input id="t1" name="t1" type="text" />
<input value="ok" name="t2" id="t2" type="submit" />
</form>
Code: Select all
<p>thanks</p>
{php}
echo $_SERVER['REQUEST_METHOD'] . "<br/>";
print_r($_POST);
print_r($_GET);
echo "<br/>t1=" . $_POST["t1"] . " (via post)";
echo "<br/>t1=" . $_GET["t1"] . " (via get)";
{/php}
Code: Select all
thanks
GET
Array ( ) Array ( [page] => test-post2/ )
t1= (via post)
t1= (via get)
What makes the change of the http request method? Is it the engine of CMSMS?
Thank you.