I would like to populate a dropdown list from a particular field of a bunch
of records.
Here's what I have so far on the modify page but it doesn't list stuff from
the database, all it prints is the number 1 which isn't in any of the
records.

One version of this will be on an add page and another will be on a modify
page which has the current field selected. For the add script, I'd just lose
all the selected stuff that's on there now.

print "<select name=\"owner\">";
$result = mysql_query("SELECT owner,agent FROM homes;");
while($a_row = mysql_fetch_array($result))
{
        printf('<option name="owner"
value="'.$a_row[owner].'">'.$a_row[owner].'</option>', $a_row[owner],
($owner == $a_row[owner]) ? "selected" : "", $a_row[owner]);
}
print "</select>";

What am I doing wrong in this code? Even when I take out the selected stuff,
I still get a value of 1 in the list instead of the actual contents of the
field.

Any help is greatly appreciated!
__________________
Jason Dulberg
Extreme MTB
http://extreme.nas.net


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to