I've searched the forum and found a few posts that gave me ideas..
I have select boxes on my site, if i select an option and update it, it'll send the information to the database, when i return to the page, i would like it to have the option i just entered into the database selected already. Is there a tutorial for this anywhere? or do someone know a bit of code i could take a look at and figure out?
Thanks,
Auto select boxes?
Moderator: General Moderators
alright i think i got it, i used this code; figured i'd post it incase someone else needs it maybe.. if its of any use... its ugly. lol
Thanks Feyd. 
Code: Select all
$HTTP_POST_VARS;
$result = mysql_query("SELECT * FROM usertable WHERE id = "$id" ");
while($myrow = mysql_fetch_assoc($result))
{
$provider= $myrowї'provider'];
}
?>
<select name="provider">
<?
$query = mysql_query("SELECT * FROM provider_table ");
while ($row = mysql_fetch_assoc($query)) {
$provider_db = $rowї'carrier'];
if ($provider_db=="$provider"){
?>
<option value="<? echo $provider_db; ?>" selected><? echo $provider_db; ?> </option>
<?
} else {
?>
<option value="<? echo $provider_db; ?>"><? echo $provider_db; ?> </option>
<?
}}
?>
</select>