display content based on select | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

display content based on select

It is possible to load content on page after selecting a select element in php or js? Like when I select a value to load something from the database and if I select the second one to soad something else, without using a framework like angular or vue?

12th May 2021, 8:10 PM
tibi
tibi - avatar
1 Antwort
0
Yes, that is possible. Step 1: Create an HTML form with the select with your options Step 2: In PHP you receive the options in the $_POST array. Then based on what the user chose, you send the appropriate content back to the user. Step 3: For convenience I recommend using something called Ajax for this kind of thing. With Ajax (Asynchronous Javascript And XML) the user doesn't have to wait untill the browser reloaded with the new content. I hope my answer helped you into the right direction.
1st Jun 2021, 1:51 PM
Leo
Leo - avatar