I need to store all the items selected from a dropdown box inside array. I have only one form now with the select dropdown list. So each time I select an item from the list and submit the form it overwrites the previous item.
How do I make it work like each time it submits the id will be stored so that I can display all the items selected?
//this is the select dropdown for addon item
<select name="addon">
                       <?php
                       mysql_select_db($database_bumi_conn, $bumi_conn);
                       $query="SELECT * FROM tbl_addons WHERE status=1";
                       $result=mysql_query($query)or die(mysql_error());
                       while($row=mysql_fetch_array($result))
                       {
                           $a_id=$row['addOns_id'];
                           $a=$row['addOns'];
                       ?>
                       <option value="<?php echo $a_id?>"><?php echo $a;?></option>
                       <?php
                       }
                       ?>
                       </select>
//And this is how I store the id 
$addon_id=$_POST['addon'];
//edited with session
$_SESSION['option']=array();
$_SESSION['option'][$addon_id]=array('qty'=>$qty,'date_1'=>$date_1,'date_2'=>$date_2);
    print_r($_SESSION['option']);
    foreach($_SESSION['option'] as $option=>$value)
    {
        echo $option.'=>';
        foreach($value as $val)
        {
            echo $val;
        }
    }
 
     
     
    