I've got a few select lists on my form which look a bit like this:
<option value="400000" <?php if($_GET['MaxPrice'] == "400000") { echo("selected"); } ?>>£400,000</option>
As you can see (above) I've got a bit of PHP in there telling the form to remember it's selection upon submit.
Is there a short bit of PHP that would remember every selection without the rather heavy method I'm using above?
Thanks in advance.
UPDATE:
<select name="MaxPrice" id="MaxPrice">
<option value="9999999" selected>Price (Max)</option>
<option value="100000" <?php if($_GET['MaxPrice'] == "100000") { echo("selected"); } ?>>£100,000</option>
<option value="200000" <?php if($_GET['MaxPrice'] == "200000") { echo("selected"); } ?>>£200,000</option>
<option value="300000" <?php if($_GET['MaxPrice'] == "300000") { echo("selected"); } ?>>£300,000</option>
<option value="400000" <?php if($_GET['MaxPrice'] == "400000") { echo("selected"); } ?>>£400,000</option>
</select>
UPDATE 2: Is there a way to implement this technique into some JavaScript?
if (BuyRent=='buy')
document.SearchForm.MaxPrice.options[9999999]=new Option("Price (Max)","150000000");
document.SearchForm.MaxPrice.options[100000]=new Option("\u00A3100,000","100000");
document.SearchForm.MaxPrice.options[200000]=new Option("\u00A3200,000","200000");
document.SearchForm.MaxPrice.options[300000]=new Option("\u00A3300,000","300000");
document.SearchForm.MaxPrice.options[400000]=new Option("\u00A3400,000","400000");