Skip to content
Advertisement

Dropdown list in HTML using PHP

I need to take UniversityID from the University selection to list institutes in this university for Institute Selection. I read it is easy with AJAX but I couldn’t solve it. For now Institute selection show all the institutes.

Institute_1 and Institute_2 in University_1
Institute_3 in University_2

I want to show Institute_1 and Institute_2 in Institute selection if user chose University_1
or
Institute_3 if user chose University_2

How I can write AJAX part or is there any better way?

JavaScript

Advertisement

Answer

You may try the following sample codes to achieve what you want (Ajax call) :

HTML (place this file in a web server to run please)

JavaScript

PHP (getfaculty.php)

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement