it's probably not the best programming, but you get the idea:
for ($e=0 ; $e < $num_employees ; $e++)
{
$employee_row = mssql_fetch_array($employees_result);
if (@$employee && @$employee_row["name"] == $employee)
echo "<option value=\"".$employee_row["name"]."\" SELECTED>".$employee_row["name"]."\n";
else
echo "<option value=\"".$employee_row["name"]."\">".$employee_row["name"]."\n";
}
what that does is for a page that i have where it displays a list of employees - if there is a variable $employee defined, and it is the same as the option being written, then it selects that employee by default (ie i can call this page from somewhere else thus: show.php?employee="My Name" - then "My Name" will be selected in the drop down box. If i just view show.php though, the first item is selected by default.)
THis is similar to what you want and think you'll be able to hack at it and convert it into what you want.
To do the second bit you ask, i would imagine what you want is a line in your page that the action calls that says something like "if (@!$textbox)" - that way, if there's nothing in the text box you can tell it to do something else - note the @ sign to hidde any errors you may get.
The trick with all these things (i've found anyway) is to do them in HTML first - dont worry about the PHP side of it, just make sure that a) you know how to do a select list, then b) you know how to select a particular value from it. When you're sure you know how to do that, then you can work on incorporating it into your PHP. If you just dive into the PHP side of it, then you're not sure if it's not working because you're PHP programming is off or because its your HTML that's not quite right.
Hope that's of use...