macha
macha

Reputation: 7487

Display selected option after form post

Hello I have a html select which has an onchange event. And whenever a user selects an option, data related to that option would be retreived from the database. But the select is set to its original or default option as a post would occur. How do I set the select to the user selected option??

I am using cakePHP for this, but I am pretty sure it is a PHP-Javascript thing.

Upvotes: 0

Views: 283

Answers (1)

Robusto
Robusto

Reputation: 31883

You can store the state of the select in a cookie and retrieve it on page load. Or retrieve the value on the server and either set it in a PHP file before you send the page to the client, or add a hidden element with that value and use that to set it on page load.

Upvotes: 1

Related Questions