Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6947075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:38:49+00:00 2026-05-27T13:38:49+00:00

just a quick one im looking to populate three drop down boxes to filter

  • 0

just a quick one im looking to populate three drop down boxes to filter data and each one of them is going to affect the next.

what i want is for

Drop down 1 has company

once drop down 1 is selected the second drop down is populated with the branches for that company

once selected the third drop down is populated by the staff members for that company in that branch then when i press search it should pull the data for that 1 staff member. all of the information is in one table

the table i have is called “stafflist”

the columns are “company”, “branch” and “staffname” each staff member has an autonumber id field which i use as a lookup called “staffID”

Thank you for any help

Regards
Slowie

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T13:38:50+00:00Added an answer on May 27, 2026 at 1:38 pm

    Lets take an easy example, This is a javascript solution. I’m using this and it works perfectly fine. This script work in case if you select a country it populates its corresponding cities in the second dropdown. You can take some idea and use this for your case where you can deal with three dropdowns respectively.

    This is the country dropdown:

    <?php
            $countrylist=mysql_query("SELECT * FROM country ORDER BY name ASC");
            echo "<select name='country' id='country' onchange=\"reload(this.form)\" title='Country e:g; United Kingdom,Pakistan'><option value='0'>Select Country</option>";
            while($clist=mysql_fetch_array($countrylist))
            {
            echo "<option value='$clist[Name]'>$clist[Name]</option>"."<br/>";
            }
            echo "</select>";
     ?>
    

    This is the region dropdown:

    <select name="region" id="region" ></select>
    

    Now make a seperate file named crlist.js and include it in the page having above code like this:

    <script  type="text/javascript" src="crlist.js"> </script>
    

    code for crlist.js:

    var request = false;
    /*@cc_on @*/
    /*@if (@_jscript_version >= 5)
    try {
    request = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
    try {
    request = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (e2) {
    request = false;
    }
    }
    @end @*/
    function fillSelect(country,path) {
    var url = path+"crlist.php?country=" + country;
    request.open("GET", url, true);
    request.onreadystatechange = go;
    request.send(null);
    }
    
    function go() {
    if (request.readyState == 4) {
    //if (request.status == 200) {
    
    var response = request.responseText;
    
    var list=document.getElementById("region");
                for (i = list.length - 1; i>=0; i--) {
                    list.remove(i);
                }
    var records=response.split('|');
    for (i=1; i<records.length; i++) {
        //alert("rcord="+records[i]);
        var record=records[i].split('*');
        var region=record[0];
        //alert("region="+region);
        var regionid=record[1];
        //alert("regionid="+regionid);
        var x=document.createElement('option');
        //var y=document.createTextNode(region);
        x.text=region;
        //x.value=region;
        //alert(x.text);
       //x.appendChild(y);
       //list.appendChild(x);
       list.options.add(x);
       }
      //}
     }
    }
    
    function initCs(path) {
    
    if (!request && typeof XMLHttpRequest != 'undefined') {
    request = new XMLHttpRequest();
    }
    var country=document.getElementById('country');
        country.onchange=function() {
    
            if(this.value!="Select") {
    
                var list=document.getElementById("region");
                for (i = list.length - 1; i>=0; i--) {
                    list.remove(i);
                }
            //while (list.childNodes[0]) {
            //list.removeChild(list.childNodes[0]);
            //}
            }
            fillSelect(this.value,path);
            //alert(this.value);
    
        }
    //fillSelect(country.value);
    }
    

    Now make a seperate file named crlist.php.

    Code for crlist.php:

    <?php
    require_once 'yourconfigfile.php';
    
    $cname = $_GET['country'];
    
    $query="select ID,Name from city where CountryCode=(select code from country where name='$cname') Order By Name ASC";
    $res = mysql_query($query) or die(mysql_error());
    while($region = mysql_fetch_array($res)){
        echo "<option value='".$region['Name']."'>".$region['Name']."</option>";
    }       
    ?>
    

    Now add following script on the page having dropdowns:

    <script  type="text/javascript" src="crlist.js"> </script>
    <script>
    $(document).ready(function() {
    
        initCs("");
    
    });
    </script>
    

    This is my own script, and i’ve assumed that you have created country and region tables. But you need to tweak the queries and above code according to your db structure. In your case you have to create tables for company, branches and employees.

    Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am looking for a quick way to grab some data off of one
Just a quick one really, I'm just looking for a bit of clarification. I'm
Just a quick one: what are peoples thoughts on using Action delegates for public
Just a quick question. I have one XML and I was hoping to tranform
Just a quick one here, does anyone know of a good regular expression for
just a quick question: I am a CS undergrad and have only had experience
just a quick question, if I have a matrix has n rows and m
Just a quick database design question: Do you ALWAYS use an ID field in
Just a quick question about ReadWriteLocks in Java (specifically the ReentrantReadWriteLock implementation) as I
Just a quick question. Say a call a method like so mysql_pconnect(server,tator_w,password) or die(Unable

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.