I want to select the specific option in drop down list when a condition is existed.I set the Session in php and if the combo box has the value of 1
, it will be shown the option with value 1
. I mean if session is 1
, select the option with value of 1
, if session is 2
, select the option with vlaue of 2
, and so on... . I want to set automatically select(I see the changes) with session in php
.
sth like blewo:
<select id="sel" >
<option value='1'>one</option>
<option value='2'>two</option>
<option value='3'>three</option>
</select>
<?php $_SESSION['num']='1'; ?>
<script>
//must be shown the option with value of `1`.
<script>