I have a user that wants to select mulitple options from a list. the problem I am having is that only the last selection is being saved to the database. Here is my code:
<?php
$options="";
$aTempVar = "";
$HaveACategory = "";
foreach ($categoriesarray as $key => $val) {
if( isset($Row['categories']) && $Row['categories'] == stripslashes($val)) {
$aTempVar = " selected ";
$HaveACategory = "Yes";
};
$options=$options . "<option " . $aTempVar . "value=" . '"' . stripslashes($val) . '"' . ">" . stripslashes($val) . "</option>";
$aTempVar = "";
};
?>
<td class="Input"><select name="categories" size="6" multiple="yes">
<?php if($HaveACategory == "") { echo "<option value=0>Choose a Category"; } ?>
<?php echo " =$options"; ?>
</option>
</select></td>
Only the last selection seems to be in the $categories var.
Anyone solved this one?
Any ideas?
TIA