Re: checkboxes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



PJ wrote:
> How to deactivate checkboxes when one in a series is checked?
> <input type="checkbox" name="choice[1]"><another input>
> <input type="checkbox" name="choice[2]"><another input1>
> <input type="checkbox" name="choice[3]"><another input2>
> <input type="checkbox" name="choice[4]"><another input3>
> So that only 1 of the other inputs could be used in a search. Probably
> do the rest with switch stuff.
> Would be neat if the deactivated checkboxes would go grey.
> Is this an HTML question? Use onclick?But I think I need to either use a
> php string or function or would this be a CSS thingy?
> Thanks for any help.
> 

Actually, you would use javascript to do this.  You may use CSS with it,
but javascript would trigger/do the deactivation/graying out.

Better to use radio buttons here.  Only one in a group can be selected.
 Use the same name for all in a group but assign a different value.  You
can use numbers as the values or use the actual value from the DB maybe.

<input type="radio" name="choice" value="1">
<input type="radio" name="choice" value="2">
<input type="radio" name="choice" value="3">
<input type="radio" name="choice" value="4">

So on submit the value of $_POST['choice'] would be 1, 2, 3, or 4.

-- 
Thanks!
-Shawn
http://www.spidean.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux