Jump to content

Recommended Posts

Hi,

 

    This is not new but I am hard finding a solution to the problem , I have 3 drop down boxes, 1st drop down box displays the values from database, based on the value selected 2nd drop down boxes displays values and similarly 3rd drop down box

 

  Also I need to have all the values selected in the drop down boxes.

 

Please help me

If all your data is stored in the database what you'll need to do is use JavaScript and AJAX to dynamically generate that data. Have a look at the example below.

 

<script type="text/javascript">
    function fire_ajax( dropDownFired ) {
        // What you need to do here is make an AJAX call to a php (or other) script to get
       // back the required data and once you have that data show the second drop down
      // box and so on ect...
    }
</script>

<!-- Drop Down 1 -->
<select name="dd1" onchange="fire_ajax('1')">
      <option value="1">1</option>
</select>

<select name="dd2" onchange="fire_ajax('2')" style="display:none;">
      <option value="1">1</option>
</select>

 

Sorry thats not a 100% answer but there is a bit of work required (maybe 30 mins or so) to write up everything and test it, ect...

 

Basically what you'll want to do in your Javascript is make an AJAX call to get back the data, then use Javascript to change the css display of the second drop down to "Block" and then use Javascript to dynamically fill in the values of that drop down list.

 

This is done much easier when using a Javascript library like jQuery.

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.