jpratt Posted November 15, 2006 Share Posted November 15, 2006 I have the following Select box:[code]<select name="faq_Model[]" size="3" multiple class="inputbox" id="faq_Model[]"> <?php do { ?> <option value="<?php echo $row_Model['Model_Name']?>" ><?php echo $row_Model['Model_Name']?></option> <?php} while ($row_Model = mysql_fetch_assoc($Model));?></select>[/code]And the following on the post of the form:[code]if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {for($i=0;$i<count($_POST['faq_Model']);$i++) { $Model.=$faq_Model[$i]." "; } $insertSQL = sprintf("INSERT INTO faq (faq_Model, faq_Cat, faq_Order, faq_Q, faq_A) VALUES (%s, %s, %s, %s, %s)", GetSQLValueString($Model, "text"), GetSQLValueString($_POST['faq_Cat'], "int"), GetSQLValueString($_POST['faq_Order'], "int"), GetSQLValueString($_POST['faq_Q'], "text"), GetSQLValueString($_POST['faq_A'], "text")); mysql_select_db($database_database, $database); $Result1 = mysql_query($insertSQL, $database) or die(mysql_error()); $insertGoTo = "index.php"; if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $insertGoTo));}[/code]My problem is it is not passing anything from the multiple select box. Any ideas why? I have really never messed with multiple selects in php and might need a little advice on this, Thanks. Link to comment https://forums.phpfreaks.com/topic/27348-multiple-select-box/ Share on other sites More sharing options...
jpratt Posted November 15, 2006 Author Share Posted November 15, 2006 Anyone? I am stumped.. Link to comment https://forums.phpfreaks.com/topic/27348-multiple-select-box/#findComment-125054 Share on other sites More sharing options...
jpratt Posted November 15, 2006 Author Share Posted November 15, 2006 bump :-\ Link to comment https://forums.phpfreaks.com/topic/27348-multiple-select-box/#findComment-125168 Share on other sites More sharing options...
SharkBait Posted November 15, 2006 Share Posted November 15, 2006 What do you get when you [code=php:0] print_r($_POST['faq_Model']); [/code] after you've submitted the form? Link to comment https://forums.phpfreaks.com/topic/27348-multiple-select-box/#findComment-125177 Share on other sites More sharing options...
jpratt Posted November 15, 2006 Author Share Posted November 15, 2006 Just says Array Link to comment https://forums.phpfreaks.com/topic/27348-multiple-select-box/#findComment-125202 Share on other sites More sharing options...
SharkBait Posted November 16, 2006 Share Posted November 16, 2006 What about [code=php:0]foreach($_POST['faq_Model'] as $item1 => $item2) { echo "{$item1} -- {$item2} <br />";}[/code]Just trying to debug your $_POST['faq_Model'] variable to see what it's storing. Link to comment https://forums.phpfreaks.com/topic/27348-multiple-select-box/#findComment-125345 Share on other sites More sharing options...
jpratt Posted November 27, 2006 Author Share Posted November 27, 2006 i think i figured it out. thanks for the help. Link to comment https://forums.phpfreaks.com/topic/27348-multiple-select-box/#findComment-131217 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.