Hi i am using a dropdown list to run different queries. the user selects an option from the list and then hits a submit button. i was just wondering if i could get the dropdown list to work without having to use the submit button? is there an easy to edit my code to acheive this ?
this is the some of the code i am using
Browes Films: Action Comedy Drama Thiller New Releases ScFi[php]
if( isset( $_POST[‘search’] ) ){
$dropdownValue = $_POST[‘category’];
switch( $dropdownValue ){
case “Action” : $query = “SELECT name,description,image FROM movies WHERE genre =‘Action’ ORDER BY id DESC LIMIT $start,$per_page”; break;
case “Comedy” : $query = “SELECT name,description,image FROM movies WHERE genre =‘Comedy’ ORDER BY id DESC LIMIT $start,$per_page”; break;
case “Drama” : $query = “SELECT name,description,image FROM movies WHERE genre =‘Drama’ ORDER BY id DESC LIMIT $start,$per_page”; break;
case “Thiller”: $query = “SELECT name,description,image FROM movies WHERE genre =‘Thiller’ ORDER BY id DESC LIMIT $start,$per_page”; break;
case “Added” : $query = “SELECT name,description,image FROM movies ORDER BY id DESC LIMIT $start,$per_page”; break;
case “ScFi” : $query = “SELECT name,description,image FROM movies WHERE genre =‘SC-FI’ ORDER BY id DESC LIMIT $start,$per_page”; break;
default : die( “You have entered something that isn’t an option in my dropdown” );
}
}
$query_run = mysql_query($query);
[/php]