select
| From: | Addison Ellis | Date: | Sun, 02 Feb 2003 22:27:53 +0000 |
| Subject: | select | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-25348@lists.php.net to get a copy of this message | ||
hi and thank you,
is there a reason this will not work? i am trying to echo an option that has already been selected in a list menu. best, addison
<select name="property">
<?
$obj = mysql_db_query($dbname,"select * from ads where id=$id;");
while($row = mysql_fetch_object($obj))
{
if ($row->property_type == $row->id)
{
$selected = "SELECTED";
} else {
$selected = "";
}?>
<option value="<? echo $row->id; ?>" <? echo $selected; ?> selected>
<? echo $row->property_type; ?>
</option>
<option value="house">house</option>
<option value="condo">condo</option>
<option value="duplex">duplex</option>
<option value="apartment">apartment</option>
<option value="land">land</option>
</select>
--
Addison Ellis
small independent publishing co.
114 B 29th Avenue North
Nashville, TN 37203
(615) 321-1791
addison@bellsouth.net
info@smipco.com
subsidiaries of small independent publishing co.
info@gloabaldog.com
info@momandpocentral.com