I have two dropdown and want to get the selected year value of the first one and add it to the url of the header page and also to the second dropdown url options so that when I select a php page from the second dropdown I can see the year value on the page.
<?php $id = $_GET['id']; ?>
<form method="post">
Report Period:
<select name="year" id="year" >
<option style="display:none;"> Select</option>
<?php
$result1 = mysql_query("select year from year_data where id=$id");
while ($row = mysql_fetch_assoc($result1)) {
$period= $row['year'];
echo "<option value=\"$period\">$period</option>";
}
?>
</select>
Type:
<select name="report" id="report" >
<option style="display:none;">--Select--</option>
<?php
echo "<option value=\"".reportA.".php?org_id={$id}&year=\">reportA</option>";
echo "<option value=\"" . reportB . ".php?org_id={$id}&year=\">report B</option>";
?>
</select>
<input type=submit name=button method="post" onClick="getValues()" value="view" >
</form>
<SCRIPT language="JavaScript">
function getValues() {
var year = document.getElementById("year").value;
var report=document.getElementById("report").value;
window.location.href = 'header.php?year=' + year.options[year.selectedIndex].value
window.location.href = report + year.options[year.selectedIndex].value
}
</SCRIPT>