Cascading Dropdown list with (AJAX, PHP)

Thread Solved

Join Date: Aug 2007
Posts: 199
Reputation: tanha is an unknown quantity at this point 
Solved Threads: 0
tanha tanha is offline Offline
Junior Poster

Cascading Dropdown list with (AJAX, PHP)

 
0
  #1
Jul 4th, 2008
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?
Attached Files
File Type: zip Cascading.zip (3.9 KB, 107 views)
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 199
Reputation: tanha is an unknown quantity at this point 
Solved Threads: 0
tanha tanha is offline Offline
Junior Poster

Re: Cascading Dropdown list with (AJAX, PHP)

 
0
  #2
Jul 4th, 2008
any idea please ...
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 199
Reputation: tanha is an unknown quantity at this point 
Solved Threads: 0
tanha tanha is offline Offline
Junior Poster

Re: Cascading Dropdown list with (AJAX, PHP)

 
0
  #3
Jul 7th, 2008
Sorry for posting again, it is three days I am doing on the attachment and I don't know what is wrong actually I traced it many times, it should work, but I dont know why not work
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 3,746
Reputation: nav33n is a jewel in the rough nav33n is a jewel in the rough nav33n is a jewel in the rough 
Solved Threads: 331
Moderator
Featured Poster
nav33n's Avatar
nav33n nav33n is offline Offline
Senior Poster

Re: Cascading Dropdown list with (AJAX, PHP)

 
0
  #4
Jul 7th, 2008
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!
Ignorance is definitely not bliss!

*PM asking for help will be ignored*
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 12
Reputation: badbart is an unknown quantity at this point 
Solved Threads: 1
badbart badbart is offline Offline
Newbie Poster

Re: Cascading Dropdown list with (AJAX, PHP)

 
0
  #5
Jul 7th, 2008
Can you be more specific about the problem you're having? Is the first dropdown not loading? Or is it the second that's not loading (depending on the value of the first)? Or is it something else entirely?

I'm currently looking your code over, but I don't really know what to look for, specifically.
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 199
Reputation: tanha is an unknown quantity at this point 
Solved Threads: 0
tanha tanha is offline Offline
Junior Poster

Re: Cascading Dropdown list with (AJAX, PHP)

 
0
  #6
Jul 7th, 2008
the second drop-down not loading (depending on the value of the first).
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 12
Reputation: badbart is an unknown quantity at this point 
Solved Threads: 1
badbart badbart is offline Offline
Newbie Poster

Re: Cascading Dropdown list with (AJAX, PHP)

 
0
  #7
Jul 7th, 2008
The problem in your code is that this block of code:

  1. /*
  2. while($department = mysql_fetch_array($resultDepartment)){
  3. $xml = $xml . '<faculty name="$department['f_name']">';
  4. $xml = $xml . '<department id= "$department['dep_id']"> $department['dep_name'] </department>';
  5. $xml = $xml . '</faculty>';
  6. }
  7.  
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.
Last edited by badbart; Jul 7th, 2008 at 6:30 pm. Reason: formatting fixed
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 199
Reputation: tanha is an unknown quantity at this point 
Solved Threads: 0
tanha tanha is offline Offline
Junior Poster

Re: Cascading Dropdown list with (AJAX, PHP)

 
0
  #8
Jul 7th, 2008
Thanks for the reply, I remove the comment, but not work, could you please have a test of it on your system ?

That would be very nice of you
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 12
Reputation: badbart is an unknown quantity at this point 
Solved Threads: 1
badbart badbart is offline Offline
Newbie Poster

Re: Cascading Dropdown list with (AJAX, PHP)

 
0
  #9
Jul 8th, 2008
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:

  1. PopulateDepartmentList(XmlHttpObj.responseXML.documentElement);

Sorry, I'll have to leave you in the hands of the AJAX experts.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 1,072
Reputation: Shanti Chepuru is on a distinguished road 
Solved Threads: 98
Shanti Chepuru's Avatar
Shanti Chepuru Shanti Chepuru is offline Offline
Veteran Poster

Re: Cascading Dropdown list with (AJAX, PHP)

 
0
  #10
Jul 8th, 2008
Check these attachments..
These are very usefull for you..

The dropdown works on both php and ajax..
Check out..
Thank
Shanti
Attached Files
File Type: zip ajax_dropdown_double.zip (218.3 KB, 186 views)
File Type: zip php_dorpdown.zip (2.0 KB, 180 views)
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC