Posted by Smitro on 08/18/05 11:05
Chris Portka wrote:
> This is a very simple question but after a long time I still can't find
> an answer looking on my own. How do you test for no user input in a
> form? Example:
>
> <form action="index.php" method="get">
> Type your first name:
> <input type="text" name="FirstName">
> <input type="submit" value="Submit">
> </form>
>
> <?php
> if ($_GET["FirstName"] == "")
> {
> echo "No user input";
> }
> ?>
>
> Is this the correct way to always test if there was nothing input by
> the user in the form? Should I test for nil or something else?
> Thanks,
> Chris
>
I also use NULL some times...eg.
if ($_GET["FirstName"] == NULL)
Navigation:
[Reply to this message]
|