Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Remember Dropdown Selection Re: Remember Dropdown Selection

#74780
Rob MacKay
Participant

Just to look at your original code – you can use a shorthand if/else like this…



and the second part – remember to close your first option tag – personally I like to build a var and echo it. You can also use number_format to set how you want your number to float.



$arOptions = array('100', '250', '500', '1000');

foreach ($arOptions as $value){

$e = "
$e .= ($value == $_GET) ? " selected " : "";

$e .= ">£" . number_format($value, 2, '.', ''); . "";

echo $e;
}