You can write a function and when using it in a script insert
$HTTP_POST_VARS as the argument:
function filled_out($form_vars) {
foreach ($form_vars as $key => $value) {
if (!isset($key) || ($value == "")) {
return false;
}
}
return true;
}
(I think this is from the Welling and Thomson book -- PHP and MySQL Web
Development.)
--
Lowell Allen
> From: "shaun" <[EMAIL PROTECTED]>
> Date: Thu, 6 Mar 2003 13:45:52 -0000
> To: [EMAIL PROTECTED]
> Subject: [PHP] Re: Checking for empty values sent from a form
>
> thanks for your reply but I was wondering if there was a way to check
> through all of the form entries with an easier way that
>
> if ($_POST['your_input_name'] == '' || $_POST['your_input_name'] == '' ||
> $_POST['your_input_name'] == '' || $_POST['your_input_name'] == '' ) //etc
> // field is empty
>
> this would be particularly useful for forms with lots of fields...
>
>
> "Niels Andersen" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>> Since input from a form are strings, you can check like this:
>>
>> if ($_POST['your_input_name'] == '')
>> // field is empty
>>
>> "Shaun" <[EMAIL PROTECTED]> wrote in message
>> news:[EMAIL PROTECTED]
>>> Is there an easy way to scan through an array of values sent from a form
>> to
>>> see if any of them are empty?
>>>
>>>
>>
>>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php