Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How Do I Pass More Than One Value With Drop Down Box?

Status
Not open for further replies.

HowdeeDoodee

Technical User
Mar 14, 2005
61
US
I need to pass more than one value from within a drop down box.

The following code is not working because the first option value statement is not correct. How do I pass three values at one time when only one option is selected by the user?

Code:
<form action="">
<br>
What source do you want to use?<br>
<input type="checkbox" name="MX" value="ON">MX<br>
<input type="checkbox" name="ZX" value="ON">ZX<br>
<br>
Which reference do you want to see?<br>
<select name="internet">
<option value=BK=Tap&CH=10&VR=20>BKTapCH10VR20
<option value="No value">No value
</select>
<br>
<input type="submit" value="Send it"><input type="reset" value="Clear it"></p>
</form>

I want the eventual output from this form to be like this...

Code:
[URL unfurl="true"]http://www.webpage.com/XZ/SeeNew.php?BT=ON&BK=Tap&CH=10&VR=20[/URL]

Thank you in advance for any replies.
 
The only thing wrong with that option statement is that you are missing the quotes around the value:
Code:
<option value=[red]"[/red]BK=Tap&CH=10&VR=20[red]"[/red]>BKTapCH10VR20

Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
The other thing wrong with it is that the & are not escaped as &amp;.

The reason I said I thought it would not work is that when the value is put in the URL, the "&" would most likely appear as "%26", not as "&", as HowdeeDoodee wants.

Dan



[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
BillyRayPreachersSon said:
the "&" would most likely appear as "%26", not as "&"

Yes, that's exactly what happens. At least when I tested it on IE6.

--James
 
Thank you for the responses. It is correct that the resulting hyperlink has % signs in the link. The link goes to a php page. I am trying to find a parse routine but have not come up with anything yet. Thank you again for the responses.

 
parse routine;

use the split() function.

for example:

Code:
var myVariable = "hs=something";
var myPartsArray = myVariable.split("=");

// displays "hs" in an alert box
alert(myPartsArray[0]);

// displays "something" in an alert box
alert(myPartsArray[1]);

*cLFlaVA
----------------------------
[tt]your mom goes to college[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
[banghead]
 
Hang on...

First you said:

I want the eventual output from this form to be like this...

Code:
[URL unfurl="true"]http://www.webpage.com/XZ/SeeNew.php?BT=ON&BK=Tap&CH=10&VR=20[/URL]

and now you're saying:

It is correct that the resulting hyperlink has % signs in the link.

Well which is it? Do you want the & escaped or don't you?

Dan


[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Dan, I was replying to your post that said

The other thing wrong with it is that the & are not escaped as &amp;.

The reason I said I thought it would not work is that when the value is put in the URL, the "&" would most likely appear as "%26", not as "&", as HowdeeDoodee wants.

My comment could be reworded and say, "Yes, Dan was correct in saying a % sign appears in the output."

So to be really, really, really clear, the output I want is

Code:
[URL unfurl="true"]http://www.webpage.com/XZ/SeeNew.php?BT=ON&BK=Tap&CH=10&VR=20;[/URL]

Anything positive is always welcomed.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top