I'm working with a multiple select list and for some reason my foreach() statement is entering the word "Array" in the mysql database instead of the selected items from the multiple select list..
I have the select section set as...
<select name="carlist[]" size="1" multiple="multiple">
<option >Select a car</option>
<?php
do {
?>
<option value="<?php echo $row_rscars['nick_name']?>"><?php echo $row_rscars['nick_name']?></option>
<?php
} while ($row_rscars = mysql_fetch_assoc($rscars));
$rows = mysql_num_rows($rscarss);
if($rows > 0) {
mysql_data_seek($rscars, 0);
$row_rscars = mysql_fetch_assoc($rscars);
}
?>
</select>
and here is my code for the foreach() statment...
foreach ($_POST['carlist'] as $value) {
$insertSQL = sprintf("INSERT INTO carservice (username, nick_name, service_provider, evaluation, lotnum, service_date, follow_up_date, total_cost, addnotes) VALUES ('{$_SESSION[loginUsername]}', %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['carlist'], "text"),
GetSQLValueString($_POST['service_provider'], "text"),
GetSQLValueString($_POST['evaluation'], "text"),
GetSQLValueString($_POST['lotnum'], "text"),
GetSQLValueString($_POST['service_date'], "date"),
GetSQLValueString($_POST['follow_up_date'], "date"),
GetSQLValueString($_POST['total_cost'], "double"),
GetSQLValueString($_POST['addnotes'], "text"));
All help is appreciated!