my select looks like this, and it displays industries to categorize an event:
Code: Select all
<?
$q5 = 'SELECT * FROM hcw_industry ORDER BY Ind_Ttl ASC';
$resultq5 = mysql_query($q5) or die('Query Error');
$countq5 = mysql_num_rows($resultq5);
echo "<select name=\"eventInd_IndID[]\" id=\"eventInd_IndID[]\" size=\"12\" multiple=\"multiple\">";
for ($i =0; $rowq5 = mysql_fetch_assoc($resultq5); ++$i) {
$indID = $rowq5['Ind_ID'];
$indName = $rowq5['Ind_Ttl'];
echo "<option value=\"$indID\">$indName</option>";
}
echo "</select>";
?>i feel there needs to be a foreach statement to write an INSERT statement per each selected value.
how would i use the loop to insert multiple entries into this table:
Code: Select all
$q1 = "INSERT INTO hcw_eventsInd (
EventInd_EventID,
EventInd_IndID,
EventInd_IndSubID,
EventInd_EventDate)
VALUES (
'".$eventID."',
'".$_POST["eventInd_IndID"]."',
'".$_POST["eventInd_IndSubID"]."',
'".$eventDate."')";
$result = mysql_query($q1) or die (mysql_error());