PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Hi
I don't know how to display values from DB when i select a value from a selection menu, as you can see from the picture, if for exemple i select HEA140 from the menu I want to display the name and radius...
Your select is named sub1, so if you want to display details of the selection on form submission, you'd need to use the value of $_POST['sub1'] in a WHERE clause. As you've used SELECT * in your original query, you technically have all the information, so you could also write that to some hidden divs which you'd display when the value of the select changes via a JavaScript event listener.
Thank you Celauran
I changed to $_POST['sub1'] but nothing changed.
How can I use WHERE in my case to select all.
I am new in programming I am reading a book to learn PHP.
At the beginning of your script, you have a query to select everything from the database. Modifying that query if $_POST['sub1'] is set will give you the desired results. You don't want to lose the initial query or you'd lose your select list, so you'll have to do both. You could do something like this