Go Premium for a chance to win a PS4. Enter to Win


Dynamic Dependent select box

Posted on 2014-03-03
Medium Priority
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" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

	  	<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
		<script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></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
  • 2
LVL 58

Accepted Solution

Gary earned 2000 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

CTAs encourage people to do something specific to show interest in your company, product or service. Keep reading to learn why CTAs should always be thought of as extremely important, albeit small, sections of websites.
The first step to building an amazing About page is to figure out what you want the page to say about your company. You then must grab the attention of the reader, boast a bit, tell a story and let others brag about you. With a little bit of thought…
Wufoo.com provides powerful tools for surveying targeted groups, and utilizing data from completed surveys to find trends, discover areas of demand or customer expectation, and make business decisions on products or services.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

927 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