Here is my initial code:
    $camp_price=array(
   'option 1' => array(
                    'id' => 'June 30 to July 20',
                    'weeks' => 3,
                    'week_price' => 995),
   'option 2' => array(
                    'id' => 'June 30 to July 13',
                    'weeks'=> 2,
                    'week_price' => 995)
  ); 
 foreach ($camp_price as $name=>$values) {
$total_cost[$name]=$values['weeks'] * $values['week_price'];
}
Here is the HTML code. It echo perfectly the $total_cost until the form gets submitted. It then show the error:
Warning: Illegal string offset 'option 1'
Which I don't understand:
  <select name="preferred_session">
  <option value="option 1" <?php if($preferred_session =='option 1') echo'selected="selected"'; ?>>
 <?php echo $camp_price['option 1']['id'],': ', $total_cost['option 1']; ?>euros
 </option>
 <option value="2" <?php if($preferred_session =='option 2') echo 'selected="selected"'; ?>>
 <?php echo $camp_price['option 2']['id'],': ', $total_cost['option 2']; ?>euros
 </option>
</select>
 
     
    