Xandir - 4:33 pm on Dec 15, 2012 (gmt 0)
I'm working on a multi-page form which the client has now requested they'd like a 'back' button. Not a problem for standard text fields, since I can simply echo the variable carrying the field value into the 'value' attribute, but for multiple select boxes - which can have up to 200 options - I'm not sure writing the following would be terribly efficient:
<option value="Apple" <?php if($vendor=='Apple') (echo 'selected'} ?>>Apple</option>
<option value="Asus" <?php if($vendor=='Asus') (echo 'selected'} ?>>Asus</option>
<option value="Asustek" <?php if($vendor=='Asustek') (echo 'selected'} ?>>Asustek</option>
... that would be a lot of typing! And, because it's a multi-select box, the variable $vendor is potentially going to have multiple values in it - so the above isn't going to work anyway.
I have quite a few of these boxes to deal with, so I'm wondering whether there's a better way of handling them?