Forum Moderators: open

Message Too Old, No Replies

Drop down value questions!

how do I do this?

         

dreamcatcher

10:29 pm on Jul 20, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi guys,

Ok, this is probably something simple, but...

If I create a drop down menu with the following....

<select name="blah">
<option>Boo</option>
</select>

...then specify "blah" as a variable, I get whatever is between the "Option" tags displayed on my page. In this case "Boo".

However, if I do...

<select name="blah">
<option value="foo">Boo</option>
</select>

...then I get "foo" displayed if I specify "blah" on my page.

So, my question is, if I use values for the drop down menus, how do I display whats actually between the <Option> tags?

So, for instance, if I have...

<select name="blah">
<option value="foo">Boo</option>
</select>

...how do I get "Boo" to display instead of "foo"?

Thanks!

:)

ncw164x

10:50 pm on Jul 20, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



try this

<select name="select"><option value="foo" selected>Boo</option></select>

ncw164x

11:04 pm on Jul 20, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you remove the spaces on all of your examples as below they all show Boo

<select name="blah"><option>Boo</option></select>
<select name="blah"><option value="foo">Boo</option></select>
<select name="blah"><option value="foo">Boo</option></select>

<select name="select"><option value="foo">Boo</option></select>

TravelSite

11:13 pm on Jul 20, 2003 (gmt 0)

10+ Year Member



dreamcatcher

I tried your code - and it displayed Boo in the drop down menu. As far as I can see the code should work. What browser are you using (have I read the question wrong?!)?

If its for variables I think you may need to look at the selectedIndex feature - try the following search in Google.com:
"drop down menu" problem selectedindex

dreamcatcher

5:48 am on Jul 21, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks for the help guys. Yes, sorry, I wasn`t being very clear, I want to display variables.

Basically, I`m using a php contact form script that displays a list of options, each with an e-mail address as a value. I want to display the names that appear in the e-mail that gets sent out, and not the value.

So, for example if one of the options was "Customer Support", ie...

<select name="send">
<option value="blah@blah.com">Customer Support</option>
</select>

...I want to display "Customer Support" in the e-mail. At the moment, what I see is the value, ie, the e-mail address "blah@blah.com".

Thanks! I`ll try some of the examples and do a search like you said TravelSite!

:)