Forum Moderators: coopster
<form>
<INPUT TYPE=checkbox NAME=catID[] VALUE="1">1
<INPUT TYPE=checkbox NAME=catID[] VALUE="2">2
<INPUT TYPE=checkbox NAME=catID[] VALUE="3">3
<INPUT TYPE=checkbox NAME=catID[] VALUE="4">4
<input type=submit yadda yadda yadda....
I can store the different values into one column, but if I pull this document up on the web again to edit it, how can I make those checkboxes that were checked originally display checked when I go to edit them?
Make sense?
[webmasterworld.com...]
[webmasterworld.com...]
[webmasterworld.com...]
Here is what I'm trying to accomplish.
I have a table that has 2 columns.
ID, Selections
ID is simply an auto incrementing integer
Selections can be any, all, or none of the following: tree, shrub, bush
Selections contains (or doesn't contain) a set of information separated by commas.
Some data would include:
¦----------------------¦
¦ ID ¦ Selections ¦
¦====¦=================¦
¦ 1 ¦ tree,shrub,bush ¦
¦----+-----------------¦
¦ 2 ¦ bush ¦
¦----+-----------------¦
¦ 3 ¦ shrub, bush ¦
¦----------------------¦
(sorry about the mangled table... how can I force it to use a courier font?)
When I open the individual forms to edit them in HTML, how do I display all the checkboxes with the already selected checkboxes checked?
I have started with 2 arrays.
$selection (to represent all the possible choices)
$selected (to represent what is already selected)
I don't know how to go through each $selection and compare it to each $selected. If I could do that, I could easily assign a 'checked="checked"' value and echo that in the HTML.
Again, I went through those links you posted but I still can't seem to get it.