Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Select Multiple into array for data insertion

New Here ,
Jan 21, 2010 Jan 21, 2010

I have a form that contains a menu/list that allows multiple selections. The list is bound to a dynamic source with label = to a name and value = to the names record ID. The code DW CS4 generates is:

<select name="vVol_id" size="20" multiple="MULTIPLE" id="vVol_id">
<?php
do { ?>
                <option value="<?php echo $row_rsGetStaff['vol_id']?>"><?php echo $row_rsGetStaff['full_name']?></option>
                <?php
} while ($row_rsGetStaff = mysql_fetch_assoc($rsGetStaff));
  $rows = mysql_num_rows($rsGetStaff);
  if($rows > 0) {
      mysql_data_seek($rsGetStaff, 0);
      $row_rsGetStaff = mysql_fetch_assoc($rsGetStaff);
  }
?>
</select>

What additional code do I need to get the selected items into an array that can be 'foreach'd' to insert the selections into another table when the submit button is clicked? This one has been driving me nuts.

TOPICS
Server side applications
314
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 21, 2010 Jan 21, 2010
LATEST

You just need the square brackets, something like: <select name="vVol_id[]"

vVol_id will then be an array if items are selected.

Ed

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines