Posted by JackM on 04/06/06 02:55
I have a multiple select input in a form that's being populated by a row
from my database as such:
<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. I'm having a
problem passing the selected value. 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();
[Back to original message]
|