question about reading checkboxes

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

 



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.


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

  Powered by Linux