Javascript change property of PHP variable according to date in list menu selection
I'm creating a booking form which selects prices and dates from a Mysql databse according to the code transported in the URL.
I have successfully got the form to display dates for this year and next year in a drop down menu/list form item.
However, I would like to change the price according to what year the selected date falls in.
The key variable that needs to change is this $coursefee
If a date in 2009 date (e.g. 2009-10-12) is selected the varibiable $coursefee would change to be
<?php $coursefee=$row_rs_course['price09'];?>
And if a date like 2010-10-12 is selected the varibiable $coursefee would change to be
<?php $coursefee=$row_rs_course['price10'];?>
To complicate matters the menu is dyamically populated too:
<select name="dates" class="course" id="dates">
<?php
do {
?>
<?php
$date1 = strftime("%d %b",strtotime($row_rs_dates['start_date']));
$date2 = strftime("%d %b %Y",strtotime($row_rs_dates['finish-date']));
?>
<option value="<?php echo($date1." - ".$date2); ?>"><?php echo($date1." - ".$date2);?></option>
} while ($row_rs_dates = mysql_fetch_assoc($rs_dates));
$rows = mysql_num_rows($rs_dates);
if($rows > 0) {
mysql_data_seek($rs_dates, 0);
$row_rs_dates = mysql_fetch_assoc($rs_dates);
</select>
I'm pretty sure the answer lies in the murky world of javascript but unfortunately I haven't the first clue about javascript.
Can anyone help me with this?
Cheers
Dave
