I have a php include as a search property in an area but the client now want it to be broken down into areas more defined ie at the moment all the area are selected from one list/menu but what they now want is for the user to select a counties and the second list to show the town and city’s in that counties so the user can select from 1,2,3 ect places to see what property are for sale

This is part of the code for the list/menu as it is some 700 lines long this also make the page very large in size so I wanted to know 2 things can the locations ie counties name and town name be put in 2 tables in SQL to be called from their and how this can be done?

I know it can be done in MS Access as a cascading combo box

<select nameselect name="PROPERTYLOCATION">
<option value="Abbeyhill" selected>Abbeyhill</option>
<option value="Abercrombie">Abercrombie</option>
<option value="Aberdeen">Aberdeen</option>
<option value="Aberdeenshire">Aberdeenshire</option>
<option value="Aberdour">Aberdour</option>
<option value="Aberfeldy">Aberfeldy</option>
<option value="Aberfoyle">Aberfoyle</option>
<option value="Aberlady">Aberlady</option>
<option value="Aboyne">Aboyne</option>
<option value="Addiewell">Addiewell</option>
<option value="Airdrie">Airdrie</option>
<option value="Airth">Airth</option>
<option value="Alexandria">Alexandria</option>

I now this can be done but how do I do it?

I know their has to be a comon link between town city ie if Nottingham and Sutton-in-Ashfield were in Nottinghamshire then they would have the group code ie

Area 1 would have to have all the towns and cities with the group ID code for that area and that the towns and cities would have to have their own ID code

    cascading lists and menus? Sounds like client side stuff to me. Have a look on smoe javascript / DHTML boards for info on that sort of thing.

    When you get it working, you may then want to know how to use PHP to automatically populate the DHTML/javascript with values form a database. When you get that far, you can post the relevant client-side code in here and ask how PHP can produce some of it for you.

    But your first step is to get the menus working for a static set of selections, and that's something you're more likely to get help on on a specialist javascript/DHTML board.

      you can do this in JS quite easily, but with large lists, it tends to be slow. If you dont mind the page reload, you can use JS to do a reload on change, loading in the second list based on the selection the user makes on the first list.

        11 days later

        OK so i have setup my js 2 stage menu

        select from 1st list is area

        addOption("First-Select", "Select an Area", "", 1); //HEADER OPTION
        addList("First-Select", "Aberdeen", "", "1");
        addList("First-Select", "Aberdeenshire", "", "2");

        From what is selected shows town in that are only

        from

        addOption("1", "Select a Town", "", 1); //HEADER OPTION
        addList("1", "Ballater", "", "Ballater");
        addList("1", "Balnagask", "", "Balnagask");
        addList("1", "Banchory", "", "Banchory");
        addList("1", "Bankhead", "", "Bankhead");
        addList("1", "Bieldside", "", "Bieldside");

        Now that all works fine but what i need to know now is how to tell the Form what has been selected

        This is what i have now

        <select nameselect name="PROPERTYLOCATION" style="width:180px;"></select><br><br><select nameselect name="PROPERTYTOWN" size="4" style="width:160px;"></select>

        Were PROPERTYLOCATION is the 1st menu and PROPERTYTOWN is the second menu this works on the form as in it displai it on the page and i can select from eather menu just fine

        What it is not doing is deting the value and writing it to SQL table so i need to know how or what i need to chang in this live of code please

        <select nameselect name="PROPERTYLOCATION" style="width:180px;"></select><br><br><select nameselect name="PROPERTYTOWN" size="4" style="width:160px;"></select>
          Write a Reply...