Select value for driopdown box

From: Date: Wed, 22 Jan 2003 18:14:55 +0000
Subject: Select value for driopdown box
Groups: php.general 
Request: Send a blank email to php-general+get-132652@lists.php.net to get a copy of this message
I am using the query below to edit a record. I want to edit the field which has a list of states in a dropdown box. I want to have the state that is in the selected field shown as the selected state. How would I do this? Query ------------------------- <? $sql = "SELECT * FROM $table_name WHERE buyerid = \"$buyerid\" "; $result = @mysql_query($sql,$connection) or die(mysql_error()); while ($row = mysql_fetch_array($result)) { $buyerid = $row['buyerid']; $state = $row['state']; $option_block .= "<option value=\"$state\">$state</option>"; } $display_block = " <select name=\"state\" class=Pgtext> $option_block </select> ?> <tr> <td width="258" class="Pgtext" height="21">State</td> <td width="259" height="21"><? echo $display_block; ?></td> </tr> --------------------------------

« previous php.general (#132652) next »