Jump to content

multiple select box


jpratt

Recommended Posts

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

  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.