Handling checkboxs (MySQL+PHP)
| From: | David Jackson | Date: | Sun, 30 Dec 2001 02:40:23 +0000 |
| Subject: | Handling checkboxs (MySQL+PHP) | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-79049@lists.php.net to get a copy of this message | ||
ALL --
The snipet below is used to generate the table containing
product info (product_id(pid), title, amount) and checkboxs.
When submit is clicked the data is passed to "instert into"
sql statement.
My question is how do I process checkbox when multi boxes have
been check. I keep thinking a array is created by check boxes?
-- David
-------- order_form.php --------
// Define table
echo "<br><table bgcolor=\"gray\" border=\"1\" >";
// Generate book listing
$result = mysql_query("SELECT pid,date,title,subtitle,author,amount FROM
catalog ") or die("Dis ain't right !!");
while (
list($pid,$date,$title,$subtitle,$author,$amount)=mysql_fetch_row($result)){
echo "<tr>\n";
echo "<td><input type=\"checkbox\" name=\"frm_pid\" value =
\"$pid\"
></td>";
echo "<td>$title</td>";
echo "<td>Price: $amount</td>";
echo "</tr>\n";
}
echo "</table>";