View Single Post
Old 05-25-07, 03:16 PM   #4
fivefeet8
Ngemu Mod
 
Join Date: Jul 2003
Location: Fresno, CA
Posts: 1,886
Default Re: Need help with updating entries automatically...

Quote:
Originally Posted by ViN86
right now i have two <select> items on a webpage. one represents companies and one represents projects.

the projects depend on which company is selected. how can i make the project dropdown box change automatically when the company dropdox box is changed?

i am working in PHP and am open to java suggestions. thx.
PHP is a server side language. To make any changes appear on the page requires a refresh with updated data.

If you want the list to change without refreshing, you will need to use is either Javascript/Java to modify the HTML DOM select items you have on your page when an onChange event happens on the Company select box. There are many ways this can be done with Javascript.

The issue is, the data is located on the server and would require:

a: Data needs to be available to the javascript upon page load.
b: Data can be pulled from the database asyncronously(AJAX).

If you don't want to go the javascript route, you could post the page back onto itself everytime you select a different company from the list. The post data would contain the currently selected company and your php script can then use that POST data to fill the projects list. You could also try using a session variable to store the currently selected company. Of course this means everytime you select a different company from the list, the page reloads.
__________________
[i7 2600k @4.4ghertz][2x4 GB DDR3 1600][EVGA GTX570 1.280GB SC][EVGA GTX460 physx][Asrock Extreme7 Gen3 Z68][2xSeagate 160 Gb SATA HD raid0][Seagate 250 GB SATA2 HD][Sony Bravia 40' 1080p LCD HDTV][NEC 3520a DVD+-DLw][Windows 7 Ultimate x64][Rosewill 1000w]
fivefeet8 is offline   Reply With Quote