Re: [PHP] checking if checkbox is checked

2001-07-06 Thread Michel 'ZioBudda' Morelli

On Wed, 4 Jul 2001, Richard Kurth wrote:

I have no try, but..

>
>
>
>
>
>

change interest* in interest[] (without number in []).

in the .php file use

if (count($interest) > 0)
 { echo "ok";
 }
else echo "no one check";


bye

-- 
Non capisco tutta questa eccitazione per il multitasking:
io sono anni che leggo in bagno
[BUONGIORNO]
--
Michel  Morelli   [EMAIL PROTECTED]

ICQ UIN: 58351764   PR of Linux in Italy
http://www.ziobudda.net http://www.linuxlab.it


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] checking if checkbox is checked

2001-07-04 Thread Steve Werby

"Richard Kurth" <[EMAIL PROTECTED]> wrote:
> I have 5 checkbox's in a form that I what to make sure at least one of
>  the checkbox is checked.
>
> 
> 
> 
> 
> 

if ( $interest == 'basic' || $interest3 == 'Internet access' || ...
$interest2 == 'platinum' )
{
echo "At least one was checked.";
}

Ignoring the first input box you could also use a loop since the field names
are sequential.  You could also handle the first field, by starting $i at 0
and only appending $i if it's greater than 0, but I don't want to clutter
the code.  The code below assumes the fields aren't preset to values other
than those listed above.

for ( $i = 1; $i < 4; $i++ )
{
$field = 'interest' . $i;
if ( ! empty( $$field ) )
{
$flag = TRUE;
}
}

if ( $flag == TRUE )
{
echo "At least one was checked.";
}

--
Steve Werby
President, Befriend Internet Services LLC
http://www.befriend.com/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]