I have been searching the forum and haven't found what I need and it just may be confusing myself even more. Anyway I have a dynamic for built from a mysql databas and I want to insert data into another table based on a users selection of checkboxes. I have the form buillt that works fine I have the checkboxes going into an array but all I get in the database is the word "array" in each column and only one row is written.
here are the snippets of the code.
the insert first.
#############################
if ((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "form1")) {
foreach ($_POST['select'])
{
$insertSQL = sprintf("INSERT INTO menu (itemID, status, siteID) VALUES (%s, %s, %s)",
GetSQLValueString($HTTP_POST_VARS['itemID'], "text"),
GetSQLValueString($HTTP_POST_VARS['status'], "text"),
GetSQLValueString($HTTP_POST_VARS['siteID'], "int"));
}
#################
now the form
#################
<form name="form1" method="POST" action="<?php echo $editFormAction; ?>">
<?php do
{
if ($row_USDAreceipies['filenumber'] != All)
{ ?>
<input name="select[<?php echo $row_USDAreceipies['filenumber']; ?>]" value="<?php echo $row_USDAreceipies['filenumber']; ?>" type="checkbox">
<input name="itemID[<?php echo $row_USDAreceipies['filenumber']; ?>]" type="hidden" value="<?php echo $row_USDAreceipies['filenumber']; ?>">
<?php echo ($row_USDAreceipies['filenumber'].' : '.$row_USDAreceipies['receipename']); ?>
<a href="../Files/<?php echo $row_USDAreceipies['file']; ?>">[View PDF]</a>
<select name="status[<?php echo $row_USDAreceipies['filenumber']; ?>]" size="1">
<option value="">Select one</option>
<option value="Pre-Made">Pre-Made (Vendor Supplied)</option>
<option value="On-Site">Prepared On-Site By Recipe</option>
</select>
<br />
<?php };
} while ($row_receipies = mysql_fetch_assoc($receipies));
?>
##############
as you can see I have 3 arrays select,itemID, and status. The select array being the checkbox that is dynamic.
What I need to insert is the itemID and the status with a siteID that is generated on another page and table. I thought I was on the right track but I seem to be stuck now. thanks in advance for you help.