Get value from Dropdown in PHP with onchange event

1.1k Views Asked by At

Good morning everyone !

Here's the situation; I have 2 dropdownlists, the first one contains some informations.. the second one, contains names of some people.

They both are filled from database.

What I want to do, is when a name is selected in the second Dropdownlist, i want automaticly to trigger a function that updates the 1st dropdownlist, using the selected text of 2nd dropdownlist in the WHERE clause of SQL Query..

I can do this in JAVA or .NET languages, but i'm new in PHP..

So can you please help me ?

2

There are 2 best solutions below

2
On BEST ANSWER

Here is a very good tutorial for same

http://www.yourinspirationweb.com/en/how-to-create-chained-select-with-php-and-jquery/

LoneWOLFs is right. its not possible using php only, to trigger onChange you will required javascript

1
On

For PHP you will have to use javascript to trigger an event on the 2nd dropdownlist. You can't do this with PHP alone.