[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-db
Subject:    Re: [PHP-DB] Inserting correct value from database into form
From:       Paul Burney <burney () gseis ! ucla ! edu>
Date:       2001-04-28 22:47:29
[Download RAW message or body]

on 4/28/01 1:32 AM, Howard Picken at hpicken@our.net.au wrote:

> <tr><td>Which Voyage:</td><td><select name="voyage" COLS=100 ROWS=1
> value="<?php echo $row["voyage"] ?>">
> 
>   <option value="One voyage only">One voyage only</option>

In an HTML <select>, you can't specify the value in the select tag (btw, you
can't specify cols or rows either).  To specify the item to pick, you must
add a " selected" keyword to the appropriate option tag.  Typically in PHP,
this is done with a series of if statements.

For example,

<option value="One voyage only"<?php

If ($row['voyage'] == 'One voyage only') { echo ' selected'; }

?>>One voyage only</option>

Hope that helps,

Paul Burney
http://paulburney.com/
http://webdevel.burney.ws/


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
For additional commands, e-mail: php-db-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic