$titles = array("Mr.","Ms.","Mrs.","Dr.","Capt.");

print "<select name=\"MemPicSalutation\" id=\"MemPicSalutation\">\n";
foreach($titles as $value)
{
    if($row['title]==$value) $sel="SELECTED"; else unset($sel);
    print "<option value=\"$value" $sel>$value</option>\n";
}
print "</select>\n";

----- Original Message -----
From: "Denis L. Menezes" <[EMAIL PROTECTED]>
To: "PHP general list" <[EMAIL PROTECTED]>
Sent: Tuesday, February 25, 2003 9:08 AM
Subject: [PHP] editing field value using selectbox with options


Hello friends.

In an edit form, I need the following select box.

<select name="MemPicSalutation" id="MemPicSalutation">
          <option value="Mr.">Mr.</option>
          <option value="Ms.">Ms.</option>
          <option value="Mrs.">Mrs.</option>
          <option value="Dr.">Dr.</option>
          <option value="Capt.">Capt.</option>
        </select>

My problem is : since I am getting the selected value from the database and showing it 
(for editing
the option value and later updating), I do not know how to show the selected 
value(value of the
option from the existing field value in the database) in the edit form(when opening 
the edit form)
along with the other option values.

Can someone help? I am using PHP and $row.

Thanks
denis


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to