User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 397,836 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,566 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: 2724 | Replies: 34 | Solved
Reply
Join Date: Aug 2007
Posts: 154
Reputation: tanha is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
tanha tanha is offline Offline
Junior Poster

Cascading Dropdown list with (AJAX, PHP)

  #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, 22 views)
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Aug 2007
Posts: 154
Reputation: tanha is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
tanha tanha is offline Offline
Junior Poster

Re: Cascading Dropdown list with (AJAX, PHP)

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

Re: Cascading Dropdown list with (AJAX, PHP)

  #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  
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation: nav33n has a spectacular aura about nav33n has a spectacular aura about 
Rep Power: 8
Solved Threads: 238
nav33n's Avatar
nav33n nav33n is offline Offline
Posting Sensei

Re: Cascading Dropdown list with (AJAX, PHP)

  #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!
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*
Reply With Quote  
Join Date: Sep 2007
Posts: 9
Reputation: badbart is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 1
badbart badbart is offline Offline
Newbie Poster

Re: Cascading Dropdown list with (AJAX, PHP)

  #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  
Join Date: Aug 2007
Posts: 154
Reputation: tanha is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
tanha tanha is offline Offline
Junior Poster

Re: Cascading Dropdown list with (AJAX, PHP)

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

Re: Cascading Dropdown list with (AJAX, PHP)

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

	/*
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>';
}
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 5:30 pm. Reason: formatting fixed
Reply With Quote  
Join Date: Aug 2007
Posts: 154
Reputation: tanha is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
tanha tanha is offline Offline
Junior Poster

Re: Cascading Dropdown list with (AJAX, PHP)

  #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  
Join Date: Sep 2007
Posts: 9
Reputation: badbart is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 1
badbart badbart is offline Offline
Newbie Poster

Re: Cascading Dropdown list with (AJAX, PHP)

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

PopulateDepartmentList(XmlHttpObj.responseXML.documentElement);

Sorry, I'll have to leave you in the hands of the AJAX experts.
Reply With Quote  
Join Date: Jul 2008
Location: Hyderabad,India.
Posts: 531
Reputation: Shanti Chepuru is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 53
Shanti Chepuru's Avatar
Shanti Chepuru Shanti Chepuru is offline Offline
Posting Pro

Re: Cascading Dropdown list with (AJAX, PHP)

  #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, 29 views)
File Type: zip php_dorpdown.zip (2.0 KB, 29 views)
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb PHP Marketplace
Thread Tools Display Modes

Other Threads in the PHP Forum

All times are GMT -4. The time now is 7:38 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC