Forum Moderators: open
<input type=\"checkbox\" name=\"subm[]\" value=\"$row[ID]\">
That part is working fine as I can check the displayed page using View Source and see that the value is the correct row number from the database. It is then being submitted on a form by $_POST method to another page where I want to evaluate the checkboxes and display the contents of the entire row that corresponds to each value=\"$row[ID]\" that have been checked. But I can't seem to get it to work. Can someone point me in the right direction?
$query = ("SELECT * FROM `table`");
$result = mysql_query($query);
print "<p>Data for Selections:";
print "<table border=2><tr><th>You chose:";
foreach ($_POST['subm'] as $value) {
print "<tr><td>";
print "$row[ID];\n";
print mysql_field_name($result, 1) . ": " . $row[name]."<br>";
print mysql_field_name($result, 2) . ": " . $row[address]."<br>";
print mysql_field_name($result, 3) . ": " . $row[city]."<br>";
print "</td></tr>";
print "</table>\n";
}
if (!isset($_POST['subm'])){
print "<p>No matching entry
}
mysql_close();
$ids=implode(",",$_POST['subm']);
$query = ("SELECT * FROM `table` WHERE `ID` IN ($ids)");
$result = mysql_query($query);
while($row = mysql_fetch_array($result)) {
and loop through from there. Works fine and I'm told that it's more secure coding, too.