What I am trying to do?
Basically a database that holds a list of items, then displays the items on a page with a checkbox next to each so the user can check the ones that apply to them.
The problem
I want the list of items to be dynamic, so through an admin panel new items can be added and when the user views the page the new items are shown all with check boxes.
That much I can do
However what I cant work out is how, when the submit button is clicked it writes the yes/no or 1/0 entries back to the database for the dynamic list.
Hopefully this makes some sense.
Here is the code that displays the list of items (in this case games played):
Basically a database that holds a list of items, then displays the items on a page with a checkbox next to each so the user can check the ones that apply to them.
The problem
I want the list of items to be dynamic, so through an admin panel new items can be added and when the user views the page the new items are shown all with check boxes.
That much I can do
However what I cant work out is how, when the submit button is clicked it writes the yes/no or 1/0 entries back to the database for the dynamic list.
Hopefully this makes some sense.
Here is the code that displays the list of items (in this case games played):
Code:
$result = mysql_query("SELECT * FROM $gameids ORDER BY name ASC");
$rows = mysql_num_rows($result);
$i = 0;
while ($i < $rows) {
$gamename = mysql_result($result,$i,"name");
$gameimg = mysql_result($result,$i,"img");
$gameid = mysql_result($result,$i,"game_id");
echo ' </tr>
<td>' . $gamename . '</td>
<td>' . $agmeimg . '</td>
<td><input type="checkbox" value="game" name="'. $gameid .'[]">
</tr> ';
$i++;
}