| | |
Cascading Dropdown list with (AJAX, PHP)
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Aug 2007
Posts: 199
Reputation:
Solved Threads: 0
Hi.
I don't know what is wrong with the following attachment, actually I have two drop down list on my html form, and which is one retrieving the value from MySQL table, and the second is dependent to the first one, and that one also gets its value from another MySQL table Using AJAX technology.
Can anyone help me through this case?
I don't know what is wrong with the following attachment, actually I have two drop down list on my html form, and which is one retrieving the value from MySQL table, and the second is dependent to the first one, and that one also gets its value from another MySQL table Using AJAX technology.
Can anyone help me through this case?
Sorry ! I don't know much about ajax+xml. Maybe you will understand what he's saying.
Check this out.
http://james.revillini.com/2006/10/2...cript-console/ and
http://james.revillini.com/2006/10/2...onsole-part-2/ All the best!
Check this out.
http://james.revillini.com/2006/10/2...cript-console/ and
http://james.revillini.com/2006/10/2...onsole-part-2/ All the best!
Ignorance is definitely not bliss!
*PM asking for help will be ignored*
*PM asking for help will be ignored*
•
•
Join Date: Sep 2007
Posts: 12
Reputation:
Solved Threads: 1
The problem in your code is that this block of code:
is commented, thus javascript can't load it.
Also, you load the faculty member's name, instead of their ID, as the "value" of the option in the first drop down. You have it coded to work correctly this way (in the query just above the commented code above), but the queries will be faster if you use the unique id for each member in the where condition of the query.
PHP Syntax (Toggle Plain Text)
/* while($department = mysql_fetch_array($resultDepartment)){ $xml = $xml . '<faculty name="$department['f_name']">'; $xml = $xml . '<department id= "$department['dep_id']"> $department['dep_name'] </department>'; $xml = $xml . '</faculty>'; }
Also, you load the faculty member's name, instead of their ID, as the "value" of the option in the first drop down. You have it coded to work correctly this way (in the query just above the commented code above), but the queries will be faster if you use the unique id for each member in the where condition of the query.
Last edited by badbart; Jul 7th, 2008 at 6:30 pm. Reason: formatting fixed
•
•
Join Date: Sep 2007
Posts: 12
Reputation:
Solved Threads: 1
Hmmm....
I'm also not an AJAX pro, nor am I even a fan, thus I've been unable to get your code to work on my system (I keep getting a Javascript error on this line:
Sorry, I'll have to leave you in the hands of the AJAX experts.
I'm also not an AJAX pro, nor am I even a fan, thus I've been unable to get your code to work on my system (I keep getting a Javascript error on this line:
PHP Syntax (Toggle Plain Text)
PopulateDepartmentList(XmlHttpObj.responseXML.documentElement);
Sorry, I'll have to leave you in the hands of the AJAX experts.
![]() |
Other Threads in the PHP Forum
- Previous Thread: Totaling multiple sums in one array
- Next Thread: Walking Through a Multi-Demnsional PHP Array
| Thread Tools | Search this Thread |
apache api archive array autocomplete beginner binary broken cakephp checkbox class cms code cron curl database dataentry date display duplicates dynamic ebooks echo email emptydisplayvalue error execute explodefunction file files firstoptioninphpdroplist folder form forms function functions google href htaccess html image include insert ip javasciptvalidation javascript joomla keywords limit link login mail matching mediawiki menu mlm multiple mysql number oop paypal pdf php phpincludeissue problem query radio random recursion recursive remote script search server sessions shot sms source sp space speed sql subdomain subscription syntax system table tag tutorial tutorials update upload url validator variable vbulletin video web white youtube






