I have two forms - one that adds a field and one to edit a field. The problem is that when you add the field the values are in a drop down list box and in my edit field it is just a text box. How can I combine the two codes below to make an edit form that displays the previously selected value and then allows the user to change this value via a listbox?

FOR ADDING
<select name="mark" size="1" class="listbox">
<?php

/
Create your SQL statement
/

$sql="SELECT bool_val from tbl_bool ORDER by bool_val;";
$result_set = pg_Exec ($conn, $sql);
$rows = pg_NumRows($result_set);

if ((!$result_set) || ($rows < 1)) {
//No connection or no rows returned, so print an error
echo "<H1>ERROR - no rows returned</H1><P>";
exit; //exit the script
}

for ($j=0; $j < $rows; $j++) {
echo "<option value=".pg_result($result_set, $j, "bool_val")."> ".pg_result($result_set, $j, "bool_val")."</option>";

}  

?>
</select>
FOR EDIT

<td width="16%"><div align="left">
<input name="mark" type="text" value="<?php echo $mark; ?>" size="26" maxlength="50">
</div></td>

    Write a Reply...