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
suhail_anwar_khan
Forum Newbie
Posts: 11 Joined: Mon Jan 15, 2007 4:22 pm
Post
by suhail_anwar_khan » Sun Jan 21, 2007 10:29 am
hi,
i have a group of checkboxes with all of their name fields marked as name=checkbox[]
in html for eg.
Code: Select all
<input type="checkbox" name="checkbox[]" value="foo1" />
<input type="checkbox" name="checkbox[]" value="foo2" />
etc.
now i want to write a php script to get the "value" attribute of the checked checkboxes so how can i do that?
Kieran Huggins
DevNet Master
Posts: 3635 Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:
Post
by Kieran Huggins » Sun Jan 21, 2007 10:33 am
they will be populated in your checkbox array. Unchecked ones will be absent.
suhail_anwar_khan
Forum Newbie
Posts: 11 Joined: Mon Jan 15, 2007 4:22 pm
Post
by suhail_anwar_khan » Sun Jan 21, 2007 10:39 am
yes i get that but how will i retrive the "value" attribute from the array
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Sun Jan 21, 2007 10:40 am
var_dump() it.. you'll see.
suhail_anwar_khan
Forum Newbie
Posts: 11 Joined: Mon Jan 15, 2007 4:22 pm
Post
by suhail_anwar_khan » Sun Jan 21, 2007 10:43 am
i want to retrive this data which is sent by a html form and the checkbox entries are in an array chechbox[]
suhail_anwar_khan
Forum Newbie
Posts: 11 Joined: Mon Jan 15, 2007 4:22 pm
Post
by suhail_anwar_khan » Sun Jan 21, 2007 10:47 am
thx a lot
i found the solution my self it was a minor mistake i didnt consider $_POST itself as an array
thx again 2 all