Posted by Rik on 05/16/06 22:06
Alec wrote:
> How do I change the drop down list so the option selected last time is
> then the current one shown in the drop down box?
> <?php $townsearch = $_get['town']; ?>
//euhm, $_GET['town'].....
> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="get">
> <select size="1" name="town">
<?php
$towns = array('ipswich','bury', 'eanske');
foreach($towns as $town){
$selected = (isset($_GET['town'])&&$_GET['town']==$town)? '
selected="selected"':'';
print("<option value=\"$town\"$selected>$town</option>");
}
> <option>ipswich</option>
> <option>bury</option>
> </select>
> <input type="submit" value="GO" />
> </form>
Grtz
--
Rik Wasmus
Navigation:
[Reply to this message]
|