How to automatically select the selected item in list menu after submitting the form?

Posted by SzamDev on Stack Overflow See other posts from Stack Overflow or by SzamDev
Published on 2010-06-11T14:02:46Z Indexed on 2010/06/11 14:42 UTC
Read the original article Hit count: 219

Filed under:
|
|
|

Hi

I have this code :

  <form id="form2" name="form2" method="post" action="">
      <table dir="ltr" width="554" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td width="269" class="da"><div align="center"><span id="spryselect1">
            <select onchange="form2.submit()" name="mpage" id="mpage">
              <option selected="selected" value="no">-----------</option>
              <option value="medmo">Medmo.com</option>
              <option value="paris">Paris.com</option>
              <option value="imo">IMO.com</option>
            </select>
          </span></div></td>
          <td width="214" class="t_b">Select Website</td>
        </tr>
      </table>

    </form>

When the user select a value, the form will automatically submit, I want the item that the user has selected to be selected after submitting the form.

Because I am facing this proplem:

The user select the first item (Medmo.com) -> form submit -> selected item will be "-------"

I want this to happen :

The user select the first item (Medmo.com) -> form submit -> selected item will be "Medmo.com"

How I can do that?

Thanks in Advance.

© Stack Overflow or respective owner

Related posts about php

Related posts about JavaScript