•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 427,222 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,280 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 3909 | Replies: 34 | Solved
![]() |
•
•
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation:
Rep Power: 8
Solved Threads: 240
@Shanti, the sql you have posted (location and state.sql) are corrupted.
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
*PM asking for help will be ignored*
*PM asking for help will be ignored*
•
•
Join Date: Jul 2008
Location: Sweet India
Posts: 828
Reputation:
Rep Power: 2
Solved Threads: 74
•
•
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation:
Rep Power: 8
Solved Threads: 240
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
*PM asking for help will be ignored*
*PM asking for help will be ignored*
•
•
Join Date: Jul 2008
Location: Sweet India
Posts: 828
Reputation:
Rep Power: 2
Solved Threads: 74
•
•
Join Date: Jul 2008
Location: Sweet India
Posts: 828
Reputation:
Rep Power: 2
Solved Threads: 74
•
•
Join Date: Jul 2008
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
Anyone able to help me with the following attachments? I'm able to select value from the first drop down list. But the second drop down list value would be that of the first drop down list. Like a repeat. I'm new at this, not sure how do I get value from another table from the database for the second drop down list. I'm trying to get card_name from the card table for the second dropdown list. Been looking at it for days. And stucked. Hope someone can help?
•
•
Join Date: Jul 2008
Location: Sweet India
Posts: 828
Reputation:
Rep Power: 2
Solved Threads: 74
•
•
Join Date: Sep 2007
Posts: 9
Reputation:
Rep Power: 0
Solved Threads: 1
Thanks to all of your guidance (this was my first time playing with AJAX), I've come up with a more configurable version of the cascading dropdown list code that my fellow Ajax-noobs might find helpful.
Here is what's in the attached zip:
AjaxCode.js - this is essentially the same as the other javascript files that have been posted here with a few minor tweaks.
data_settings.php - this is a file that's included in the php pages that query the database. It contains the hostname, username, password, and database name for the database that will house the tables, creates the database connection and selects the database.
index.php - this is a more dynamic main page that builds itself using two tables. The first table, ajax_data, contains all the data to be placed in the dropdowns. The second table, ajax_labels, contains the descriptions labels for each dropdown and more importantly, an id field that determines the value passed in the onchange event to load the dependent dropdown options.
tables.sql - this is the sql to build and fill the generic tables used by the code. You can add any number of dropdowns by adding records to ajax_labels and ajax_data with the proper corresponding id (in the label table) and parent & level (in the ajax_data table).
xml_data_provider.php - this is essentially the same file as was attached in the first post, with the required tweaks to make it work.
One question for you AJAX experts: Do you have any idea why using an ampersand in the text description (the book title in my attached example) causes an error? To duplicate the error, just replace the word "and" with "&" in any of the titles.
For example, this causes an error:
Here is what's in the attached zip:
AjaxCode.js - this is essentially the same as the other javascript files that have been posted here with a few minor tweaks.
data_settings.php - this is a file that's included in the php pages that query the database. It contains the hostname, username, password, and database name for the database that will house the tables, creates the database connection and selects the database.
index.php - this is a more dynamic main page that builds itself using two tables. The first table, ajax_data, contains all the data to be placed in the dropdowns. The second table, ajax_labels, contains the descriptions labels for each dropdown and more importantly, an id field that determines the value passed in the onchange event to load the dependent dropdown options.
tables.sql - this is the sql to build and fill the generic tables used by the code. You can add any number of dropdowns by adding records to ajax_labels and ajax_data with the proper corresponding id (in the label table) and parent & level (in the ajax_data table).
xml_data_provider.php - this is essentially the same file as was attached in the first post, with the required tweaks to make it work.
One question for you AJAX experts: Do you have any idea why using an ampersand in the text description (the book title in my attached example) causes an error? To duplicate the error, just replace the word "and" with "&" in any of the titles.
For example, this causes an error:
<mxml><parent_level name="1"><child_level id="9">The Hitchhiker`s Guide to the Galaxy</child_level></parent_level><parent_level name="1"><child_level id="10">The Restaurant at the End of the Universe</child_level></parent_level><parent_level name="1"><child_level id="11">Life, the Universe, & Everything</child_level></parent_level><parent_level name="1"><child_level id="12">So Long and Thanks for all the Fish</child_level></parent_level><parent_level name="1"><child_level id="13">Mostly Harmless</child_level></parent_level><parent_level name="1"><child_level id="14">Dirk Gently`s Holisitic Detective Agency</child_level></parent_level><parent_level name="1"><child_level id="15">The Salmon of Doubt</child_level></parent_level><parent_level name="1"><child_level id="16">Last Chance to See</child_level></parent_level></mxml>![]() |
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Previous Thread: Publishing php/mysql on Apache website
- Next Thread: How many queries can be preformed in one click?



Linear Mode