|
Posted by Justin Koivisto on 10/06/05 17:36
DrewBe12@gmail.com wrote:
> Exactly.
>
> if ($_POST['submit']) // Gives you the validation that the submit
> button itself has been pushed,
>
> then to detect an empty field
>
> $myfield = trim($myfield);
> if (!$myfield)
> {
> echo "error, no data provided";
> }
Assuming that $myfield was a text input, a hidden field, a select
element, a textarea, etc. Checkboxes that aren't selected and radio
button groups that don't have a value chosen will not even exist in the
$_POST array... Also, you should have used:
$myfield = trim($_POST['myfield']);
Get out of the habit of using register_globals - especially when trying
to give examples in a newsgroup. Too many newbies will wonder why it
isn't working for them, then we'll get the whole "if
register_globals=On" threads again...
--
Justin Koivisto, ZCE - justin@koivi.com
http://koivi.com
Navigation:
[Reply to this message]
|