I twice had the following issue with my custom CMS : posting a form with post method did not result in sending any data to the form action page. Printing $_POST :
print_r($_POST);
always resulted in displaying the following on my page :
array();
My .htaccess file simply set Magic_quotes to 0, Register_Globals to 0 and PHP_VER to 5. Then I have 301 redirects :
SetEnv MAGIC_QUOTES 0SetEnv REGISTER_GLOBALS 0SetEnv PHP_VER 5Options +FollowSymlinks -MultiViewsRewriteEngine onrewritecond %{http_host} ^mydomain.be [nc]rewriterule ^(.*)$ http://www.mydomain.be/$1 [r=301,nc]
And the empty $_POST problem comes from the 301 redirect. Indeed, my form was posted to http://mydomain.be/index.php thanx to a “base” tag set inside the head of my document :
<base href=’http://mydomain.be/’ />
and the form action looks like the following :
<form method=’post’ action=’./index.php’>
With the 301 redirect that has mydomain.be point to www.mydomain.be and the form pointing to mydomain.be/index.php, Apache does not associate $_POST with www.mydomain.be but with domain.be. Hence the empty $_POST issue.
I hope this will spare you some debugging time.
Webliography :