Image

Imagepaul_mann wrote in Imagephp

Dropdown issue - setting defaults from a list

I have a multi table DB, tbl_Profile and tbl_Area are the two that concern me at the moment.

tbl_Area consists of two rows: id (int, auto increment) & area (varchar 25).

What I would like to do is to allow my users to update their profile but on the update form the selected item in the dropdown select is the first that comes out of the following code:

function list_area()
{
if(!mysql_connect(HOST, USER, PASS))
{
die('failed to connect');
}

mysql_select_db(DB);

$result= mysql_db_query(DB, "SELECT * FROM tbl_Area Order by area");
while($row=mysql_fetch_row($result))
{
echo"<option ... >$row[1]</option>";
}
}

What I would like to do is have the users chosen value at registration be the default value for that user.

Any ideas, hints etc..?

Thanks again

Paul