Jump to content

sort by


An7hony

Recommended Posts

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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.