An7hony Posted May 24, 2010 Share Posted May 24, 2010 Hi I have 2 jump menus which im using for sort by Sown below the jump menus: <select name="select" onChange="MM_jumpMenu('parent',this,1)" class="basic-combo" > <option value="#" selected>All Locations</option> <option value="/index.php?view=jobs&location=1">Lincoln</option> <option value="/index.php?view=jobs&location=2">Mansfield</option> <option value="/index.php?view=jobs&location=3">Grantham</option> </select> and <select name="select" onChange="MM_jumpMenu('parent',this,1)" class="basic-combo" > <option value="#" selected>Sort By. . .</option> <option value="/index.php?view=jobs">All Job Types</option> <option value="/index.php?view=jobs&sort=1">Temporary</option> <option value="/index.php?view=jobs&sort=2">Permanent</option> <option value="/index.php?view=jobs&sort=3">Perm to Temp</option> </select> Here is my php <?php $sortbylocation = intval($_GET['location']); switch ($sortbylocation) { case 1: { $sortlocation = "WHERE branch = 'Lincoln'"; };break; case 2: { $sortlocation = "WHERE branch = 'Mansfield'"; };break; case 3: { $sortlocation = "WHERE branch = 'Grantham'"; };break; //etc with the rest of the attributes } $sortby = intval($_GET['sort']); switch ($sortby) { case 1: { $sqlExtra = "WHERE jobtype = 'Temporary'"; };break; case 2: { $sqlExtra = "WHERE jobtype = 'Permanent'"; };break; case 3: { $sqlExtra = "WHERE jobtype = 'Temp to Perm'"; };break; //etc with the rest of the attributes } ?> and where its sorting: <?php $sql = "SELECT id, agent, branch, title, location, salary_from, salary_to, frequency, jobtype, description, specifications, benefits, email, created_at, categories FROM $tbl_name ".$sortlocation." ".$sqlExtra." LIMIT $start, $limit"; $result = mysql_query($sql); ?> question is how do i make the second menu dependant on the first menu option? Quote Link to comment https://forums.phpfreaks.com/topic/202727-sort-by/ Share on other sites More sharing options...
-Karl- Posted May 24, 2010 Share Posted May 24, 2010 Search for chained select menus Quote Link to comment https://forums.phpfreaks.com/topic/202727-sort-by/#findComment-1062572 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.