Skip to content
Advertisement

How to display a selected option in `drop-down menu` in a PHP update form?

I have to display a selected option in the drop down list preview, but currently when extracting the value from the database it only shows one option and not the other from the database.

Is there a way to show the actual drop down list option when extracting the known value from the database (PgAdmin)(All code is either HTML,CSS or PHP)

Basically, I want it show the value in the database as the selected option in the Drop-Down menu, as you probably see in the below code I have tried but I am not too sure how to progress further from this point. Also feel free to correct me on errors within my code. I am aware it is a bit to digest but hopefully this will be answered soon πŸ™‚

JavaScript

I have tried something like this but it didn’t really work: (Below), Its a very vague attempt but as I said before it doesn’t work I can’t really figure it out

JavaScript

Below is what I want to change. When displaying the extracted data from the table I want it to show β€˜QLD’ instead it shows the default β€˜NSW’, how do I adapt the code to do this?

JavaScript

Advertisement

Answer

It will look somewhat like this:

PHP

JavaScript

HTML

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