Page 1 of 1

multiple checkbox selection

Posted: Wed May 21, 2008 2:21 am
by vb_123
How to select multiple check boxes ata a time thru php???I want that when i select multiple check boxes it must remain selected while doing form validation

Re: multiple checkbox selection

Posted: Wed May 21, 2008 5:33 pm
by emmbec
Are you doing form validation with JavaScript or with what? explain more what you are trying to accomplish please.

Re: multiple checkbox selection

Posted: Wed May 21, 2008 11:19 pm
by vb_123
I am doing form validation with PHP and what i want is .........suppose there are 10 fields in a from and are are mandatory to fill and user has forgot to fill 1 field lets say "last name" so when the user press the submit button an error occured of filling the last name and all other fields remain filled as it is including the multiple check box which he has already selected.........i hope this will help u understand better.......thanks in advance

Re: multiple checkbox selection

Posted: Thu May 22, 2008 6:46 am
by mike9955
well .if u have 10 check boxes. for example

<input name="mychecbox1" type="checkbox" value="sdsd" checked />
<input name="mychecbox2" type="checkbox" value="sdsd" checked />

when u submit the post , u read the value form the checkbox like

$_POST['mychecbox1']

to check if the checkbox is checked or not do this

if($_POST['mychecbox1']=="")
{
//warning message
}
else
{

//continue process
}

hopes that helps