AP257 AP257 - 1 year ago 76
HTML Question

Set value of select element based on GET parameters, without JavaScript?

Here's a very basic HTML question for you:

<form method="get" action="#">
<select id="u" name="u">
<option value="nothing" title=""></option>
<option value="AdamT" title="AT">Adam Temple</option>
<option value="AlexP" title="AP">Alex Potts</option>
<INPUT TYPE="submit" />

After submitting the form, the URL ends
. However, the list has reverted to the blank element.

Is there any way I could make the list be pre-selected with the correct option, without using JavaScript?

Answer Source

Add selected (its a boolean attribute) to the appropriate <option> element in whatever server side language you use to process the form.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download