[advanced search]
Results from the most recent live auction are here.
20 members in the live chat room. Join Chat!
Register Rules & FAQ NP$ Store Active Threads Mark Forums Read
Go Back   NamePros.Com > Design and Development > Programming
User Name
Password

Old 12-08-2003, 12:35 PM   · #1
adam_uk
Senior Member
 
Trader Rating: (17)
Join Date: May 2003
Posts: 2,211
NP$: 6170.25 (Donate)
adam_uk is a jewel in the roughadam_uk is a jewel in the roughadam_uk is a jewel in the rough
Breast Cancer
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


Please register or log-in into NamePros to hide ads
adam_uk is offline   Reply With Quote
Old 12-09-2003, 05:33 AM   · #2
Mp)Tarh
....what?
 
Mp)Tarh's Avatar
 
Location: Ontario, Canada
Trader Rating: (0)
Join Date: Aug 2003
Posts: 101
NP$: 171.00 (Donate)
Mp)Tarh is an unknown quantity at this point
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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?
Mp)Tarh is offline   Reply With Quote
Old 12-09-2003, 12:12 PM   · #3
adam_uk
Senior Member
 
Trader Rating: (17)
Join Date: May 2003
Posts: 2,211
NP$: 6170.25 (Donate)
adam_uk is a jewel in the roughadam_uk is a jewel in the roughadam_uk is a jewel in the rough
Breast Cancer
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
adam_uk is offline   Reply With Quote
Old 12-09-2003, 12:35 PM   · #4
adam_uk
Senior Member
 
Trader Rating: (17)
Join Date: May 2003
Posts: 2,211
NP$: 6170.25 (Donate)
adam_uk is a jewel in the roughadam_uk is a jewel in the roughadam_uk is a jewel in the rough
Breast Cancer
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
adam_uk is offline   Reply With Quote
Old 12-09-2003, 03:34 PM   · #5
deadserious
Senior Member
 
Trader Rating: (13)
Join Date: Aug 2002
Posts: 1,300
NP$: 2.85 (Donate)
deadserious has a spectacular aura aboutdeadserious has a spectacular aura about
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?
deadserious is offline   Reply With Quote
Old 12-09-2003, 03:55 PM   · #6
adam_uk
Senior Member
 
Trader Rating: (17)
Join Date: May 2003
Posts: 2,211
NP$: 6170.25 (Donate)
adam_uk is a jewel in the roughadam_uk is a jewel in the roughadam_uk is a jewel in the rough
Breast Cancer
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
adam_uk is offline   Reply With Quote
Closed Thread

NamePros is a revenue sharing forum.

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


Site Sponsors
RealTechNetwork EscrowDNS Buy Flash Arcade Game Script
Advertise your business at NamePros
All times are GMT -7. The time now is 09:15 AM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0