Add All option to jump menu
Posted: Thu Aug 12, 2010 9:23 am
I have this code work well, but a "ALL" option would be nice. I have seen this done before but not sure how.
here is my code.
The best example I can find is as follows, but I can seem to wrap my head around it. Might just need some more coffee...
here is my code.
Code: Select all
<?php
// Connect to your MySQL database
require "dbconnect.php";
// Select the data
$select = mysql_query( "SELECT `agency` FROM csv WHERE `agencytype` = 'something' GROUP BY `agency`") or die("SELECT Error: ".mysql_error());
?>
<select onChange="window.open(this.options[this.selectedIndex].value,'_top')">
<?
// Begin grabbing the rows from your database
while ($row = mysql_fetch_array($select)) {
?>
<option value="queryws.php?agency=<? echo $row['agency']; ?>">
<? echo $row['agency']; ?>
</option>
<?
}
?>
</select>Code: Select all
if ((!empty($_GET['agency']))&&($_GET['agency'] != 'all'))
{
$sql .= " and agency like '". addslashes($_GET['agency'])."%' ";
}