Re: question about reading checkboxes

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

 



Hi Sudhakar

if it's only one selection you want, why not use a select drop down box? 
then the user can only give one answer.

http://www.w3schools.com/html/tryit.asp?filename=tryhtml_select3

Also why use javascript when you can do it all in php?

J.

Justin / Getafixx

I'm not questioning your powers of observation I'm merely
remarking upon the paradox of asking a masked man who he is. - V

Download Getafixx's latest electronica mix - Hypnopompic State
http://getafixx.com/music/mixes/hypnopompic_state/
http://getafixx.com - aural bliss




Sudhakar wrote:

> in the form i have made there are nearly 10 options for a question
> which are checkboxes
>
> ex= type of operation system = windows, windows xp, etc...
>
> i have given different names for all these checkboxes the validation
> is the user has to select atleast one checkbox. presently i am using
> the following code which is too long for the browser to process
>
> var os1=document.enquiryform.os1.checked where os1 is the value of
> the operating system and the same for the remaining checkboxes
>
> if(!(os1 || os2 || os3 || .... os10))
> {
> alert("Please select any one of the operating systems");
> return false
> }
>
> this code works however i would like a more efficient code to do
> this validation
>
> also in the form action i am calling a php file, presently i am
> reading the value of all the checboxes and concatinating into one
> variable. the php code is =
> $os1 = !empty($_POST["os1"]);
> if($os1) $os1="DOS, "; else $os1= ""; and for the remaining
> checkboxes
> $os= $os1.$os2 . .......... os10;
>
> please advice about the code in javascript and how to read these
> checkboxes in php.
>
> thanks.
>
>
>
> Are you looking for a PHP job? Join the PHP Professionals directory Now!
> http://www.phpclasses.org/professionals/
> Yahoo! Groups Links
>
>
>
>
>

[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux