October 31st, 2013, 05:40 PM
FORM works with GET, but not POST
I have a form which quite happily works locally on my laptop in both WAMP & XAMPP.
When I use method="post" the values get transfered ok, and likewise the same when I use method="get".
However, when I run the same form on a Windows 2008 Server it works fine with the method="get" (As expected, I can see the values in the URL), but fails to transfer any values when using method="post" i.e.
Wamp = Both "post" & "get" work without a problem.
XAMPP = Both "post" & "get" work without a problem.
Server = Only "get" works. "Post" fails to tranfer any values.
The fact that the form works ok on my laptop when using WAMP or XAMPP leads me to suspect that the Windows Server needs to be configured to allow the use of "post" in forms, or at least to allow form values to be passed i.e. like global variables.
However, I'm not sure if this thinking is correct or whether I simply need to enable something on the server.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en" >
<FORM action="test.php" method="post">
First name: <INPUT type="text" name="firstname"><BR>
Last name: <INPUT type="text" name="lastname"><BR>
email: <INPUT type="text" name="email"><BR>
<INPUT type="radio" name="sex" value="Male"> Male<BR>
<INPUT type="radio" name="sex" value="Female"> Female<BR>
<INPUT type="submit" value="Send"> <INPUT type="reset">
The TEST.PHP File
echo "POST: ";
var_dump( $_POST );
echo "GET: ";
var_dump( $_GET );
VAR_DUMP ( $_POST ); confirms that the array is empty
Any guru out there know the answer?
November 7th, 2013, 01:18 PM
So the error appears when you are trying to retrieve or you send the values?