Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Dec 2006
    Location
    i'm from anywhere!
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    drop down filter

    hi, can anyone here help me how can i do a sequential filtering. here's what I want to happen with my php code... when i select a region to my drop down menu it will display its list of province into another drop down menu. please advice...

    here is my code;


    PHP Code:
            <td colspan="3"><select name="region" id="region">


    <?php

        
    include("dbconnect.php");

        
    $position1 mysql_query("SELECT regionid, regionname FROM region ORDER BY regionname");

        while(
    $row mysql_fetch_array($position1MYSQL_NUM)) {

        echo 
    "<option value=\"$row[0]\">$row[1]</option>\n";
                
        }

    ?>
        
        </select></td>
        </tr>
        <tr>
        <td width="117" height="37"><div align="right"><strong>Province</strong></div></td>
        <td>&nbsp;</td>
        <td colspan="3"><select name="province" id="province">
              
    <?php

        
    include("dbconnect.php");

        
    $position1 mysql_query("SELECT provincialid, provincename FROM province ORDER BY provincename");

        while(
    $row mysql_fetch_array($position1MYSQL_NUM)) {

        echo 
    "<option value=\"$row[0]\">$row[1]</option>\n";
                
        }

    ?>
        
        </select></td>

  • #2
    New to the CF scene
    Join Date
    Dec 2006
    Location
    i'm from anywhere!
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    please could somebody here help me

  • #3
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    You can generate the list of information you need, but to dynamically populate the combo or list box without reloading requires javascript.
    Populate the data that you want the onchange behaviour to use, and pass the array into javascript when the page is processed.
    PHP is not capable of dynamically creating information on the fly. It is a server side language, and once the page has been parsed and sent to the browser, the php job is done.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •