Problems with dynamically created checkbox

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
tolearn
Forum Newbie
Posts: 9
Joined: Wed Nov 29, 2006 5:27 am

Problems with dynamically created checkbox

Post by tolearn »

Hi,

Im trying to create multiple checkboxes dynamically.

I need to fetch the value if the check box selected in the next page.

Is there any solution.
hrubos
Forum Contributor
Posts: 172
Joined: Sat Oct 07, 2006 3:44 pm

Re: Problems with dynamically created checkbox

Post by hrubos »

tolearn wrote:Hi,

Im trying to create multiple checkboxes dynamically.

I need to fetch the value if the check box selected in the next page.

Is there any solution.
If I understand your question, I think you should insert value by cliking checkbox button and select in a new page.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

The checkbox status will be available on the next page via it's name. If you've created a checkbox group (where there are two or more checkboxes with the same name) then it is easier to name with similar to "foo[]". The important part being the brackets. This will cause PHP to build an array of the values given to it by the browser. Sometimes being a bit more specific is preferential so a name of "foo[id]" where "id" is the unique part for each checkbox will set which element name each checkbox is given inside the resulting array.

I personally use the value attribute most often to signify which checkboxes were actually selected.
Post Reply