/    Sign up×
Community /Pin to ProfileBookmark

Reset drop down list value?

After the user clicks a button, I would like to reset the chosen value of a drop down menu. For example, if I have the following drop down menus:
<?
for (i =0; i<7; i++){
?>
<span class=”style1″>Out</span>
<td width=””><select id=”stop<? echo $i ?>” name= “stop<? echo $i ?>”>
<option value=”0″ default></option>
<option value=”0″>12:00 AM</option>
<option value=”0.5″>12:30 AM</option>
<option value=”1″>1:00 AM </option>

<?
}
?>

How can I change the option value from 0 to 12:00 AM so that A12:00 AM gets saved to the database (and not the 0)? Is it possible in php so that I can do something like this:

stop1 option value = stop1 option text

I have 14 drop down menus with each having 24 options, so if I could something like that statement it would be very help.

Please note, for a good reason (and I dont want to get into because its just a long story), I cannot recode the above option values to the following (if I could, I wouldnt be posting this):

<option value=”12:00 AM”>12:00 AM</option>
<option value=”12:30 AM”>12:30 AM</option>
<option value=”1:00 AM”>1:00 AM </option>

Any help is greatly appreciated! =)

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@jpmoriartyMar 27.2004 — i think instead of default you put SELECTED and it should work
×

Success!

Help @Someone 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,
)...