Entry
Why doesn't a POST work with PHP4/IIS4 when a GET does?
Apr 19th, 2001 08:50
Mike Boucher, Clinton Ingrams,
Be sure that you aren't calling the variables via
$HTTP_GET_VARS["varName"] when using POST method. Use
$HTTP_POST_VARS["varName"]
Quick Example:
<FORM method="post" action="my.php">
First Name: <INPUT type="text" name="Fname"><BR>
Last Name: <INPUT type="text" name="Lname">
</FORM>
------
In your PHP
<?
echo $HTTP_POST_VARS["Fname"]."
".$HTTP_POST_VARS["Lname"];
function insertSQL()
{
globals $HTTP_POST_VARS;
$dblink = mysql_connect("localhost","user","password");
$db = "myDB";
$query = "INSERT INTO customer VALUES
('$HTTP_POST_VARS[Fname]','$HTTP_POST_VARS[Lname]')";
$dbResults = mysql_db_query($db, $query, $dblink);
}
?>
I've always had to register HTTP_POST_VARS and
HTTP_GET_VARS as a global to access them inside of a function.
Never worked without it but maybe it was just a fluke.
Hope this helps in some way.
Good Luck