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
Share on other sites

  • 2 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.