Hello, I have a drop down, maintaining values. Such as "Countries". I know there is a way of getting the select box to maintain a value from a database. e.g: on a edit account page, i would like it to show there current country, what will be selected from a database using PHP. I would be very grateful if someone could help, as i am not the best with JavaScript. Thank you in advance.
It has nothing to do with JS I guess. You just do a db query, fetch data and in echo it in a PHP loop. Example:
Thank you, i don't think i said it correctly. What i mean is; say when a user submits a register form, they select a country, but there is an error with the form. How would i get it to hold the value if it is NOT submitted into the database. Thanks once again.
If you want to store data before the form gets submitted and processed by PHP, you need AJAX to send it to PHP and store in the database. If you don't do JS validation, so the form error you mentioned is generated by PHP, then before printing it do SQL insert.