[UPHPU] Posting a form
Jonathan Gale
jon at jtoo.net
Thu Feb 24 10:22:55 MST 2005
Scott,
> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
>
> ...form fields
>
> <input type="submit" name="submit" />
> </form>
Some more testing reveals a difference in behavior between IE and FF:
If you provide a value to your submit button it will pass that value to
the form as if you had clicked the button. This works in FF when you
press "Enter" instead of clicking the button:
<?php
if (isset($_POST['submit']))
{
echo "POST3d!";
var_dump($_POST);
exit;
}
?>
<form method=POST>
<input type=text name=test1>
<input type=submit name=submit value="Submit This Puupy">
</form>
But you get nothing in IE.
I have been bitten by this before and that is why I switched to checking
the $_SERVER['REQUEST_METHOD'] to see if the page was POST'd.
The hidden variable method also works well as suggested by Dave.
-J
More information about the UPHPU
mailing list