I asked this question previously but i think i made it too complex, I want to assign a query if a value from a list is selected.
<form id="filter" name="filter" method="post" action="">
<select>
<option value="petrol">Petrol</option>
<option value="diesel">Diesel</option>
</select>
<p><input name="filter" type="button" value="Filter" /></p>
</form>

What i want to achieve is if user selects petrol the run the following query
$query = mysql_query("SELECT fuel_type from car WHERE fuel_type = 'petrol'");
If you want to post the value in form submit use like this
If you don’t want to submit the form, you can use jquery in onchange event…
js code
yourfile.php