Re: Best way to test for form submission?
| From: | Shawn McKenzie | Date: | Fri, 28 Aug 2009 16:56:07 +0000 |
| Subject: | Re: Best way to test for form submission? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-297435@lists.php.net to get a copy of this message | ||
Adam Jimerson wrote:
> This question might give away the fact that I am a php noob, but I am
> looking for the best way to test for form submission in PHP. I know in
> Perl this can be done with
>
> if (param)
>
> but I don't know if that will work with PHP. I have read the Learning
> PHP 5 book and the only thing that was mentioned in the book was the use
> of something like this
>
> print "<p>Hello ".$_POST['username']."</p>";
>
> I'm sure that this is not the best/recommended way to do this but I'm
> hoping someone here will point me in the right direction.
Just to throw it into the mix:
if(!empty($_POST)) for a general test of whether any form was posted.
--
Thanks!
-Shawn
http://www.spidean.com