Refine Results with dropdown box
<p>I would like to refine the results of mysql query using dropdown boxes... live site is here:
<a href="http://www.halfwayenterprises.com/search/tyrell.php" rel="nofollow">http://www.halfwayenterprises.com/search/tyrell.php</a></p>

<pre><code>     &lt;form name="doublecombo" action="" method="POST"&gt;

    &lt;label for="status"&gt;Status:&lt;/label&gt;

&lt;label for="current"&gt;
&lt;input class="radio_style" id="current" checked="checked" name="status" type="radio" value="current"&gt;
Current
&lt;/label&gt;

&lt;label for="obsolete"&gt;
&lt;input class="radio_style" id="obsolete" name="status" type="radio" value="obsolete"&gt;
Obsolete
&lt;/label&gt;

&lt;label for="both"&gt;
&lt;input class="radio_style" id="both" name="status" type="radio" value="both"&gt;
ALL
&lt;/label&gt;

&lt;br /&gt;&lt;br /&gt;




&lt;select name="category" size="1" onChange="redirect(this.options.selectedIndex)"&gt;
&lt;option value="null"&gt;Category&lt;/option&gt;
&lt;option value="asset management"&gt;Asset Management&lt;/option&gt;
&lt;option value="budget"&gt;Budget/Finance&lt;/option&gt;
&lt;option value="central office"&gt;Central Office&lt;/option&gt;
&lt;option value="disposal"&gt;Disposal&lt;/option&gt;
&lt;/select&gt;





&lt;select name="subcategory"&gt;
&lt;option value="null"&gt;Sub-Category&lt;/option&gt;
&lt;option value="Portfolio"&gt;Portfolio&lt;/option&gt;
&lt;option value="Pricing"&gt;Pricing&lt;/option&gt;
&lt;option value="Valuation"&gt;Valuation&lt;/option&gt;

&lt;option value="Disposal"&gt;Disposal&lt;/option&gt;





&lt;/select&gt;
&lt;input name="submitted" type="submit" value="GO"&gt;

&lt;br /&gt;









Seach for: &lt;input type="text" name="find" /&gt; in 
&lt;Select NAME="field"&gt;
&lt;Option id="title" VALUE="title"&gt;Title&lt;/option&gt;
&lt;Option id="poc" VALUE="poc"&gt;POC&lt;/option&gt;
&lt;Option id="purpose" VALUE="purpose"&gt;Purpose&lt;/option&gt;

&lt;/Select&gt;

&lt;input type="hidden" name="searching" value="yes" /&gt;





&lt;input name="submitted" type="submit" value="GO"&gt;

&lt;/form&gt;


&lt;select name="filter1"&gt;
&lt;option value="az"&gt;Sort by A-Z&lt;/option&gt;
&lt;option value="date"&gt;Sort by Date&lt;/option&gt;
&lt;/select&gt;

&lt;select name="filter2"&gt;
&lt;option value="office"&gt;Sort by Office&lt;/option&gt;
&lt;option value="p"&gt;P&lt;/option&gt;
&lt;option value="pt"&gt;PT&lt;/option&gt;
&lt;option value="pf"&gt;PF&lt;/option&gt;
&lt;/select&gt;

&lt;select name="filter3"&gt;
&lt;option value="mandatory"&gt;Mandatory&lt;/option&gt;
&lt;option value="nonmandatory"&gt;Non-Mandatory&lt;/option&gt;
&lt;option value="combined"&gt;Combined&lt;/option&gt;
&lt;/select&gt;


&lt;/form&gt;





&lt;/p&gt;

&lt;script&gt;
&lt;!--

/*
Double Combo Script Credit
By JavaScript Kit (www.javascriptkit.com)
Over 200+ free JavaScripts here!
*/

var groups=document.doublecombo.category.options.length
var group=new Array(groups)
for (i=0; i&lt;groups; i++)
group[i]=new Array()

group[0][0]=new Option("Sub Category")


group[1][0]=new Option("Portfolio")
group[1][1]=new Option("Pricing")
group[1][2]=new Option("Valuation")

group[3][0]=new Option("Central Office")
group[4][0]=new Option("Disposal")

var temp=document.doublecombo.subcategory

function redirect(x){
for (m=temp.options.length-1;m&gt;0;m--)
temp.options[m]=null
for (i=0;i&lt;group[x].length;i++){
temp.options[i]=new Option(group[x][i].text,group[x][i].value)
}
temp.options[0].selected=true
}

function go(){
location=temp.options[temp.selectedIndex].value
}
//--&gt;
&lt;/script&gt;

&lt;?



mysql_connect("localhost", "name", "pasword") or die(mysql_error()); 
mysql_select_db("db") or die(mysql_error()); 

if(isset($_POST["submitted"])){

$status = $_POST['status'];


$category = $_POST['category'];
$subcategory = $_POST['subcategory'];





echo '&lt;div class="status_div"&gt;';

if($status=='current')

{
echo "&lt;h2&gt;Results&lt;/h2&gt;&lt;p&gt;";

$res = mysql_query("SELECT * FROM material WHERE status='$status' AND category='$category' AND subcategory='$subcategory' ORDER BY `documentid` ASC");

while ($row = mysql_fetch_assoc($res)) {


echo '&lt;div class="current"&gt;';



echo $row ['documentid'].' - '.$row['category'].' - '.$row['title'].' - '.$row['status'];

echo '&lt;/div&gt;';

echo '&lt;br&gt;';


}

} if ($status=='obsolete')


{
echo "&lt;h2&gt;Results&lt;/h2&gt;&lt;p&gt;";
$res = mysql_query("SELECT * FROM material WHERE status='$status' AND category='$category' ORDER BY `documentid` ASC ");

while ($row = mysql_fetch_assoc($res)) {



echo $row ['documentid'].' - '.$row['category'].' - '.$row['title'].' - '.$row['status'];



echo '&lt;br&gt;';


} 




} if ($status=='both')  

{

echo "&lt;h2&gt;Results&lt;/h2&gt;&lt;p&gt;";
$res = mysql_query("SELECT * FROM material WHERE status1='both' AND category='$category' ORDER BY `documentid` ASC");

while ($row = mysql_fetch_assoc($res)) {
echo '&lt;div class=""&gt;';



echo $row ['documentid'].' - '.$row['category'].' - '.$row['title'].' - '.$row['status'];

echo '&lt;/div&gt;';

echo '&lt;br&gt;';

} 

}








echo '&lt;/div&gt;';

}















$field = @$_POST['field'] ;
$find = @$_POST['find'] ;
$searching = @$_POST['searching'] ;
$status = $_POST['status'];

//This is only displayed if they have submitted the form 
if ($searching =="yes") 
{ 
echo "&lt;h2&gt;&lt;/h2&gt;&lt;p&gt;"; 


//If they did not enter a search term we give them an error 
if ($find == "") 
{ 

echo "&lt;a href='tyrell.htm'&gt;Return&lt;/a&gt;";
exit; 
} 


// We preform a bit of filtering 
$find = strtoupper($find); 
$find = strip_tags($find); 
$find = trim ($find); 

//Now we search for our search term, in the field the user specified 


if($status=='current'){

$data = mysql_query("SELECT * FROM material WHERE status='$status' AND lower($field) LIKE'%$find%' LIMIT 0,30");

while ($row = mysql_fetch_assoc($data)) {

echo '&lt;div class="current"&gt;';

echo $row ['documentid'].' - '.$row['category'].' - '.$row['title'].' - '.$row['status'];

echo '&lt;/div&gt;';

echo '&lt;br&gt;';

}




}

if ($status=='obsolete'){

$data = mysql_query("SELECT * FROM material WHERE status='$status' AND lower($field) LIKE'%$find%' LIMIT 0,30");

while ($row = mysql_fetch_assoc($data)) {

echo '&lt;div class="obsolete"&gt;';

echo $row ['documentid'].' - '.$row['category'].' - '.$row['title'].' - '.$row['status'];

echo '&lt;/div&gt;';

echo '&lt;br&gt;';

} 




} if ($status=='both'){

$data = mysql_query("SELECT * FROM material WHERE status1='both' AND lower($field) LIKE'%$find%' LIMIT 0,30");

while ($row = mysql_fetch_assoc($data)) {

echo '&lt;div class=""&gt;';

echo $row ['documentid'].' - '.$row['category'].' - '.$row['title'].' - '.$row['status'];

echo '&lt;/div&gt;';

echo '&lt;br&gt;';

} 

}









//This counts the number or results - and if there wasn't any it gives them a little message explaining that 
$anymatches=mysql_num_rows($data); 
if ($anymatches == 0) 
{ 
echo "Sorry, but we can not find an entry to match your query&lt;br&gt;&lt;br&gt;"; 
} 

//And we remind them what they searched for 
echo "&lt;b&gt;Searched For:&lt;/b&gt; " .$find; 
} 


?&gt;

&lt;p align="center"&gt;&lt;font face="arial" size="-2"&gt;This free script provided by&lt;/font&gt;&lt;br&gt;
&lt;font face="arial, helvetica" size="-2"&gt;&lt;a href="http://javascriptkit.com"&gt;JavaScript
Kit&lt;/a&gt;&lt;/font&gt;&lt;/p&gt;'
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>I have can't think of how to use the drop downs without having a submit button</p>
