first of all you need to add unique values to chkboxes (I am not familier with php, sorry if i make some mistakes)
<input name="show" type="checkbox" value="'.$getinfo2["id"].'
so, you will have the chknames values will be 12,45,78
on the next page when you request form variables for show, you will get "12,45,78" and you can use it directly in dynamic sql or split and loop through... its up to you...
??? should be something like this : if dbvalue="yes" then "checked" else ""
dont know how to write this
Main Topics
Browse All Topics





by: elvin66Posted on 2009-11-06 at 17:30:36ID: 25764555
First of all, you should give each checkbox a unique name not just 'Show'. You are using a loop so you could create a counter and append the name with the counter number as in
$count = 1;
$check_name = "show".$count;
and before the very end of the loop put
$count++
Now, in your code replace
<td><input name="Show" type="checkbox" value="Yes" title="Checked = Yes | Unchecked = No" /></td>
with
<td><input name=".$check_name." type="checkbox" value="Yes" title="Checked = Yes | Unchecked = No" /></td>
Also, you need to do a query before this loop or during it to see if the value in the database is yes or no (or whatever the values are) so I would modify the final code to read something like:
if($value == 'yes'){
echo "<td><input name=".$check_name." type='checkbox' value='Yes' Checked = true></td>";
}else{
echo "<td><input name=".$check_name." type="checkbox" value="No"></td>";
}
Now for the final part of your question, how to send those values to a new page, the checkbox is part of the form so the name and value of each checkbox will be sent to the new page with the users choice. So on that page you just need some 'if' statements to work out if each one has been checked or not.
Hope this has been some help