Posted by Mike Willbanks on 05/17/05 21:31
Chris,
> You could do it like this instead of using the @, although your way is
> less verbose.
>
> $name = isset($_POST['name']) ? $_POST['name'] : '';
>
> An advantage of doing it this way is it this way lets you specify a
> default value.
sometimes an even better way is with empty, for say if a field is
required data :)
if (empty($_POST['name'])) {
echo('Name must be filled out.');
}
Navigation:
[Reply to this message]
|