Posted by Alan Little on 05/17/06 00:13
Carved in mystic runes upon the very living rock, the last words of Rik
of comp.lang.php make plain:
> 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"':'';
The SELECTED attribute is a boolean attribute, and does not require a
value (though it can have one)
http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.3.4.2
--
Alan Little
Phorm PHP Form Processor
http://www.phorm.com/
[Back to original message]
|