I'm a newbie in PHP. I'm trying to figure out a way to pass a second paramter in a URL by clicking a link instead of a submit button. For example, my page has a link that reads: <td><a href="agencydetails.php?id=1">Adams County</a></td> - the id=1 is the first parameter, I need to pick the year in a drop down, for example 2009, then when I click the link, I want it to pass agencydetails.php?id=1&year=2009 in my url. I have a simple piece of my code below so you can see what I mean. I have a submit button in there, but I don't want to use it.
<?php
$year = "2011";
// update
if (isset($_POST['Submit'])) {
echo "Year selected is " . $_POST['year'];
}
?>
<html>
<form name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<br />
<label for="year">year:</label>
<select name="year">
<option <?php echo (isset($_POST['year']) || $year == "2011") ? 'selected="selected"' : ''; ?> value="2011">2011</option>
<option <?php echo (isset($_POST['year']) || $year == "2010") ? 'selected="selected"' : ''; ?> value="2010">2010</option>
<option <?php echo (isset($_POST['year']) || $year == "2009") ? 'selected="selected"' : ''; ?> value="2009">2009</option>
<option <?php echo (isset($_POST['year']) || $year == "2008") ? 'selected="selected"' : ''; ?> value="2008">2008</option>
</select>
<br /><br />
<input type="submit" name="Submit" value="Update">
</form>
<table width="50%" class="text">
<tr align="center" valign="top">
<td><a href="agencydetails.php?id=1">Adams County</a></td>
<td><a href="agencydetails.php?id=2">Douglas County</a></td>
<td><a href="agencydetails.php?id=3">Jefferson County</a></td>
<td><a href="agencydetails.php?id=4">Yuma County</a></td></tr>
</html>