/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] "Drop-down Select Box" default value?

I am not really sure if this is a php question. But if it is possible, i guess there will be some php in the solution.. Anyways. An update script that i have written is shown below. Is it possible to have the Drop-down Select Box thing default to a particular value (the value that is already in the database), not necessarily the value that is listed first?

[code=php]<?
include(“config.php”);

mysql_connect($host,$username,$password);
@mysql_select_db($database) or die( “Unable to select database”);

if ($id){
$query=”SELECT * FROM members WHERE id=’$id'”;
$result=mysql_query($query);

$num=mysql_numrows($result);

mysql_close();

$i=0;
while ($i < $num) {

$koc_name=mysql_result($result,$i,”koc_name”);
$dm_rank=mysql_result($result,$i,”dm_rank”);
$stats=mysql_result($result,$i,”stats”);

Echo”<form action=’update2.php’ method=’post’ >
<input type=’hidden’ name=’id’ value=’$id’>
KoC Name: <input type=’text’ name=’koc_name’ value=’$koc_name’><br>

Rank: <select name=’dm_rank’ size=’1′>
<option value=’Deranged’>Deranged</option>
<option value=’Deviant’>Deviant</option>
<option value=’Derilious’>Derilious</option>
<option value=’Demented’>Demented</option>
<option value=’Maniacal’>Maniacal</option>
</select><br>
Stats Link: <input type=’text’ name=’stats’ value=’$stats’><br>
<input type=’Submit’ value=’Update’>
</form>
</p>”;

$i++;
}

} else { Echo “Error: No ID selected.”;
}
?>[/code]

Hope you understand the question, and thank you

Shears ?

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@NogDogJul 09.2006 — Take a look at [url=http://www.webdeveloper.com/forum/showthread.php?t=112747]this thread[/url] from a day or two ago.
Copy linkTweet thisAlerts:
@ShearsauthorJul 17.2006 — Thank you. That page was very useful. ?

Shears
×

Success!

Help @Shears spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...