Results from the most recent live auction are here .
20 members in the live chat room. Join Chat !
12-08-2003, 12:35 PM
· #1 Senior Member
Join Date: May 2003
Posts: 2,211
NP$: 6170.25 (
Donate )
bit of a stupid question....i really should no this
hey people
im building a script and its gonna have a drop down menu with 1 - 100
when they add there age it gets entered into a database ive done that
now when they visit the page again i want the value of the age (say 34) selected so if there 34 when they visit the page 34 is selected
ive totally forgot
ive googled but no such luck
12-09-2003, 05:33 AM
· #2 ....what?
Location: Ontario, Canada
Join Date: Aug 2003
Posts: 101
NP$: 171.00 (
Donate )
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
window.myform.myselect.value = 36;
//-->
</SCRIPT>
<NOSCRIPT>
<!-- error -->
</NOSCRIPT>
change the objects to the form and select objects in your document.
__________________
Yeah... I knew that. What?
12-09-2003, 12:12 PM
· #3 Senior Member
Join Date: May 2003
Posts: 2,211
NP$: 6170.25 (
Donate )
that didnt seem to work
Code:
<form name='form11' method='post' action=''>
<select name='age11'>
<option value=''></option>
<option value='36'>36</option>
<option value='bob' >bob</option>
</select></form>
thats my select box
it goes all the way from 1-100, i took them out basically because it would take up to much space here but you get the idea plus ive taken out all the other boxes n stuff
and my code i modifed is
Code:
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
window.form11.age11.value = 36;
//-->
</SCRIPT>
<NOSCRIPT>
<!-- error -->
</NOSCRIPT>
it doesnt seem to do anything it always leaves the first feild selected
12-09-2003, 12:35 PM
· #4 Senior Member
Join Date: May 2003
Posts: 2,211
NP$: 6170.25 (
Donate )
admins, can i get my name changed to worlds biggest plonker?
ive had the awnser in front of me for since sunday!!!!!!!
thanks for your help Mp)Tarh
12-09-2003, 03:34 PM
· #5 Senior Member
Join Date: Aug 2002
Posts: 1,300
NP$: 2.85 (
Donate )
Quote: Originally posted by adam_uk admins, can i get my name changed to worlds biggest plonker?
ive had the awnser in front of me for since sunday!!!!!!!
thanks for your help Mp)Tarh
Sure, we can change it if you want.
Hmm isn't something like this:
<option value="34" selected>34</option>
what you were looking for? Simply how to have a certain option selected by default?
12-09-2003, 03:55 PM
· #6 Senior Member
Join Date: May 2003
Posts: 2,211
NP$: 6170.25 (
Donate )
Quote: Originally posted by deadserious Sure, we can change it if you want.
Hmm isn't something like this:
<option value="34" selected>34</option>
what you were looking for? Simply how to have a certain option selected by default?
in a way yes, but the value can change depending on an option inside a database
i sussed it with this
PHP Code:
$form = "<select name='age'>" ;
$x = 0 ;
while( $x < 100 ){
if( $x == "$age" ) {
$bob = "SELECTED" ;
}else{
$bob = "" ;
}
$form .= "<option value='$x' $bob>$x</option>" ;
$x ++;
}
$form .= "</select>" ;
$age = the value of the database
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off