View Full Version : DD's Chained select for use as search criteria

06-30-2009, 07:27 PM
1) Script Title: Chained Selects

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex16/chainedselects/chainedselects.html

3) Describe problem: Hello all!

I have basic, coding knowledge and have been delving further into programming, recently getting into php and a tiny bit of mySQL.

I am trying to use the Chained Selects Menu code to populate a select field in a form. I then need to pass the populated field with the other info collected from the form (city, state, zip, etc) to pull info from a database. My search form works, and the field populates but the subcategory field does not seem to be passed through with the rest of the form info. I am at a loss of how to change it's original function, a "goTo" menu, into a search field.

Here is part of the config.js code
addListGroup("chainedmenu", "categories");

addOption("categories", "Select an item", "", 1); //HEADER OPTION
addList("categories", "Air Compressor & Tools", "", "Air Compressor & Tools");
addList("categories", "Cleaning & Maintenance", "", "Cleaning & Maintenance");
addList("categories", "Compaction", "", "Compaction");
addList("categories", "Concrete & Masonry", "", "Concrete & Masonry");
addList("categories", "General Construction Tools", "", "General Construction Tools");
addList("categories", "Generators & Accessories", "", "Generators & Accessories");
addList("categories", "Heating, Air, Ventilation", "", "Heating, Air, Ventilation");
addList("categories", "Lawn & Landscape", "", "Lawn & Landscape");
addList("categories", "Pumps & Trenchers", "", "Pumps & Trenchers");
addList("categories", "Scaffolding, Ladders, Lifts", "", "Scaffolding, Ladders, Lifts");

addOption("Air Compressor & Tools", "Select an item", "", 1); //HEADER OPTION
addList("Air Compressor & Tools", "Air Backfill Tampers", "", "Air Backfill Tampers");
addList("Air Compressor & Tools", "Air Compressor", "", "Air Compressor");
addList("Air Compressor & Tools", "Air Compressor Accessories", "", "Air Compressor Accessories");
addList("Air Compressor & Tools", "Air Grinders,Saws,Drills","", "Air Grinders,Saws,Drills");
addList("Air Compressor & Tools", "Air Impact Wrenches", "", "Air Impact Wrenches");
addList("Air Compressor & Tools", "Air Nailers & Staplers", "", "Air Nailers & Staplers");
addList("Air Compressor & Tools", "Air Magnetic Drills", "", "Air Magnetic Drills");
addList("Air Compressor & Tools", "Air Power Post Driver", "", "Air Power Post Driver");
addList("Air Compressor & Tools", "Air Rotary Hammers", "", "Air Rotary Hammers");///END OF THIS NODE

Here is the code for the search box:
<form name="listmenu0" method="post" action="/viewers/tool_rentals_results.php">
<td width="23" height="46" class="listings_1">&nbsp;</td>
<td colspan="2" class="listings_2">&nbsp;</td>
<td width="23" class="listings_3">&nbsp;</td>
<td rowspan="5" class="listings_4"><br>
<td colspan="2" class="listings_5"><span class="style15">
</span><span class="style33">Item # (optional)</span><span class="style11 style8"><strong><span class="style11"><br>
<input name="item_keyword" type="text" id="item_keyword" size="6">
<span class="style33"><br>
<select name="category" style="width:180px;">
<span class="style33">Subcategory:</span>
<select name="subcategory_match" style="width:160px;">
<td rowspan="5" class="listings_6">&nbsp;</td>
<td height="45" colspan="2" class="listings_5"><span class="style33">City:</span><span class="style11 style8"><strong><span class="style11"><br>
<input name="city_keyword" type="text" id="city2" size="18"></td>
<td width="63" class="listings_5"><span class="style33">State:</span></td>
<td width="108" class="listings_5"><span class="style11"><span class="style32">Zip:</span></span></td>
<td height="33" class="listings_5"><select name="state_keyword" id="state_keyword" class="txtb1">
<option value="">&nbsp;</option>
<option value="AK">AK</option>
<option value="AL">AL</option>
<option value="AR">AR</option>
<option value="AZ">AZ</option>
<option value="CA">CA</option>
<option value="CO">CO</option>
<option value="CT">CT</option>
<option value="DE">DE</option>
<option value="FL">FL</option>
<option value="GA">GA</option>
<option value="HI">HI</option>
<option value="IA">IA</option>
<option value="ID">ID</option>
<option value="IL">IL</option>
<option value="IN">IN</option>
<option value="KS">KS</option>
<option value="KY">KY</option>
<option value="LA">LA</option>
<option value="MA">MA</option>
<option value="MD">MD</option>
<option value="ME">ME</option>
<option value="MI">MI</option>
<option value="MN">MN</option>
<option value="MO">MO</option>
<option value="MS">MS</option>
<option value="MT">MT</option>
<option value="NC">NC</option>
<option value="ND">ND</option>
<option value="NE">NE</option>
<option value="NH">NH</option>
<option value="NJ">NJ</option>
<option value="NM">NM</option>
<option value="NV">NV</option>
<option value="NY">NY</option>
<option value="OH">OH</option>
<option value="OR">OR</option>
<option value="OK">OK</option>
<option value="PA">PA</option>
<option value="RI">RI</option>
<option value="SC">SC</option>
<option value="SD">SD</option>
<option value="TN">TN</option>
<option value="TX">TX</option>
<option value="UT">UT</option>
<option value="VA">VA</option>
<option value="VT">VT</option>
<option value="WA">WA</option>
<option value="WV">WV</option>
<option value="WY">WY</option>
<td class="listings_5"><input name="zip_match" id="zip2" size="7" maxlength="5"></td>
<td colspan="2" align="center" valign="bottom" class="listings_5"><div align="center">
<input type="submit" name="submit3" id="submit3" value="Search" onClick="goListGroup(document.listmenu0.firstlevel, document.listmenu0.secondlevel, document.listmenu0.thirdlevel)">>
<input type="reset" name="submit3" id="submit4" value="Clear">
Any help is greatly appreciated!!!:)