multiple checkbox selection

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
vb_123
Forum Newbie
Posts: 19
Joined: Wed May 21, 2008 2:16 am

multiple checkbox selection

Post 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
User avatar
emmbec
Forum Contributor
Posts: 112
Joined: Thu Sep 21, 2006 12:19 pm
Location: Queretaro, Mexico

Re: multiple checkbox selection

Post by emmbec »

Are you doing form validation with JavaScript or with what? explain more what you are trying to accomplish please.
vb_123
Forum Newbie
Posts: 19
Joined: Wed May 21, 2008 2:16 am

Re: multiple checkbox selection

Post 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
mike9955
Forum Newbie
Posts: 2
Joined: Thu May 22, 2008 6:29 am

Re: multiple checkbox selection

Post 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
Post Reply