tags:

views:

12

answers:

3

I am having a problem sending POST parameters with my relatively fresh Apache install.

In my document root, I have a file test.html which has the following:

<form action="/test" method="POST">
  <input type="text" name="param" value="test" />
  <input type="submit" />
</form>

My .htaccess file sets the index file to be serve.php, as follows:

DirectoryIndex serve.php

Inside serve.php, I simply print out the POST parameter as follows:

<?= $_POST['param'] ?>

As written, this does not work. If I change the method to GET (and also change the serve.php file to access GET) it works. If I explicitly specify the action to be "/test/serve.php" it works.

Somehow it appears the POST parameters are being lost in translation to the index file. Thoughts on why?

A: 

Just wondering that the GET is working due to the parameters being contained within the URL, whereas, in POST they do not?

POST Submits data to be processed (e.g., from an HTML form) to the identified resource. The data is included in the body of the request. This may result in the creation of a new resource or the updates of existing resources or both.

Just wondering if the variables contained within the body of the request aren't being passed through by the Apache directive, perhaps its something Apache didn't think would be required?

Jim Grant
I believe this is the case.
Kevin Dolan
A: 

Just add '/' to the ACTION url dummy!

Kevin Dolan
A: 

Looks like your POST data get lost when redirecting from /test to /test/.

Try <form action="/test/" method="POST">

Messa