Dynamic Dependent select box

Posted on 2014-03-03
Last Modified: 2014-03-03
I'm trying to build a test case of a dynamic dependent select box using mysql/php, ajax, jquery.   Should be streight forward but I having problems.

Here is the test page:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

	  	<script src=""></script>
		<script src=""></script>
      	<script type="text/javascript">
                     var depth=$("#depth").val();

Depth :
        <select name="depth" id="depth">    
        include "support_db.php";
        $result=mysql_query("SELECT Category,Series,Glass_Support,Finish,Key_2 FROM Form_Content WHERE Category='Depth' and Series='CRY140-2'");
        	echo "<option value=$depth[Key_2]>$depth[Finish]</option>";
        } ?>
        Support :
        <select name="Sup_lft" id="Sup_Lft">
            <option>-select Support-</option>

**********************  support_get.php  *****************
  include "support_db.php";
  $result=mysql_query("select Display_Name,Key_3 FROM Products where Pri_Group = 'CRY140' AND Sec_Group='Lft' AND Key_2='$depth'");
echo"<option value=$Sup_lft[Key_3]>$Sup_lft[Display_Name]</option>";


Open in new window

The include "support_db.php"  and mysql/php access seems to be working.  I have verified that the mysql data is in place. The first select box is functioning.  The Ajax fetch doesn't populate the second select box.   I hope someone will be able to easily point out what I have wrong.

Question by:jws2bay
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 58

Accepted Solution

Gary earned 500 total points
ID: 39901625

should be


Notice the case

Author Comment

ID: 39901727
Don't you hate that.   I changed the id to Sup_lft and all is good.

Thanks for giving it a quick look.

Author Closing Comment

ID: 39901731
Correct answer and quick

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Node.js 11 72
warning code: class php incomplete message 6 67
Pass SQL to JSON. Page is in classic ASP and using Jquery 4 54
modify font on ninja form 1 17
Learn by example how to specify CSS selectors for Selenium WebDriver test automation software.
These days, all we hear about hacktivists took down so and so websites and retrieved thousands of user’s data. One of the techniques to get unauthorized access to database is by performing SQL injection. This article is quite lengthy which gives bas…
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to selectively show certain fields based on user input using rules to gather relevant information and data from your forms. The rules feature provides you with an opportunity…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question