Current location: Hot Scripts Forums » Programming Languages » PHP » refreshing dropdown list when selecting another drop down list


refreshing dropdown list when selecting another drop down list

Reply
  #1 (permalink)  
Old 08-13-08, 04:08 AM
theighost theighost is offline
Newbie Coder
 
Join Date: Jul 2008
Posts: 51
Thanks: 0
Thanked 0 Times in 0 Posts
refreshing dropdown list when selecting another drop down list

i am using code igniter in the website i'm working on and i need php combined with any language to do:

for example i have a dropdown list named states that takes its values from a data base, and i have another dropdown list named cities that has its values from a database also.

when i click on a state the city dropdown list should show the cities in that state only.

i read that i need ajax...which i dont know hot to use

any hints or scripts?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 08-13-08, 11:10 AM
Keith's Avatar
Keith Keith is offline
Community Liaison
 
Join Date: Feb 2004
Posts: 1,232
Thanks: 1
Thanked 11 Times in 11 Posts
AJAX would probably be the best way to go. With a solution like this, 10 developers will give you 10 solutions, all differing in method but all ultimately achieving the same goal.

I would suggest you look into JavaScript libraries such as Mootools, Prototype, jQuery, etc, and use their pre-developed solutions for AJAX requests. Just read up on the documentation.

I would also personally recommend using PHP's json_encode() function coupled with Mootools' Request and JSON classes. Make a GET or POST request to a PHP file to return the cities as a JSON-encoded array, decode the array with JSON.decode(), and write the select with the resulting object.
__________________
The toxic ZCE
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
DropDown List On Mouse Over event on a Button cosc_19 Script Requests 3 05-04-08 03:18 PM
Selecting current hour in dropdown list toth ASP 7 01-26-06 04:24 AM
trouble with the display of results and drop down list.. SummerL PHP 0 07-11-05 11:38 AM


All times are GMT -5. The time now is 11:51 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.