You are here: Re: Drop Down Lists « PHP Programming Language « IT news, forums, messages
Re: Drop Down Lists

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация