close ad
Help us test the new Databridge BETA with MySQLi support
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Retaining Dynamic Dropdowns Search options on page reload

Thread began 3/05/2011 7:56 am by paul386190 | Last modified 3/10/2011 12:25 pm by paul386190 | 2076 views | 5 replies


Retaining Dynamic Dropdowns Search options on page reload

Hi there

I have managed to set up a search facility using a couple of linked dynamic dropdowns and the data assist search wizard within a client's admin tool. Basically they make a selection from the first dropdown - this dynamically populates the second dropdown, they then make a selection from the second dropdown and hit a 'search' button. I've set up the page to be both the search and results page so when page then refreshes is displays the search facility and the results. However, the problem I'm having is getting the two dropdowns to retain their original search selections on the page reload. For example, if they select 'Car' from the first and 'Ford' from the second, when they hit the search it reloads the page with the results but the dropdowns are still displaying 'Car' and 'Ford'. I was originally able to do this when the search facility only had one dropdown as i could set a 'select value equal to' to the correct id, but it doesn't seem to work now that I'm running two linked dropdowns and the second when doesn't contain any content when initially loaded.

Just to give a little background I have three tables labelled 'Level 1', 'Level 2' and 'Level 3' and their basic structure is...
level1 contains: level1_id and level1_name (this table populates the first dropdown)
level2 contains: level2_id, level2_name and level1_id (this table populates the second dropdown)
level3 contains: level3_id, level3_name and level2_id (this table populates the search results)

I've tried a few variations...

1. No initially selected options (not even a 'Select an option') and Populate List from Array - Target list options - Leave Top set to 0. This just returns with the first value displaying in the first dropdown and the second dropdown empty.

2. The same as above but Leave Top set to 1. This just populates the second menu with an initial empty option when the first dropdown option has been chosen.

3. Setting the initially selected value of the first dropdown to <?php $row_level2['level1_id'] ?>. This dropdown is set with 'Options from Recordset - level1', 'Values - level1_id' and 'Labels - level1_name'. This just gives the same result as the first variation.

4. Same as above but additionally adding <option value=""<?php if (!(strcmp($row_level2['level2_id'], $row_level3['level2_id']))) {echo "selected=\"selected\"";} ?>></option> between the <select></select> tags of the second dropdown. This just gives the same result as the first variation.

I'm guessing it's a fairly straightforward issue that I'm missing and would be extremely grateful for any assistance.
Many thanks in advance.

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question





Ease of use


security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...