Jump to content

Multiple drop down lists via php MySQL


sheryprince

Recommended Posts

Hello Friends!.... here is the big idea. I am trying to make a form in which there will be 2 drop down lists which will be populating directly from MySQL DB ....

Actually i am developing a student management system as my first PHP project... here i want to have 2 drop down lists first is roll number and second is student name. i want that when some one select the roll number in the first drop down the student name against it is automatically populated in the next drop down.

 

 

Plz help me friends i am new to php and dont know soo much.! any help PLZZZZZZZZZZ

Link to comment
https://forums.phpfreaks.com/topic/247259-multiple-drop-down-lists-via-php-mysql/
Share on other sites

you use javascript to grab the selected name in the first dropdown. you can trigger the javascript function with the element's onchange tag.

You can do a select box with onChange="functionName(this.value);" to send the name, then you use ajax to send that name to a php file that will build the second dropdown and send it back to your javascript, Once you grab the AJAX responseText, you use somthing like this to print the combo onto the page:

document.getElementById("divName").innerHTML = returnedComboBox;

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.