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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple Option Values

Status
Not open for further replies.

JoeMost

Technical User
Oct 24, 2000
26
US
Hi,

A beginners question...hope someone can help

I have a dropdown menu passing information to a form.
(Actually it is passing Price data to a simple shopping cart)

<select name="Resumes">
<option value="$100.00">30 Day Resume Search</option>
<option value="$150.00">60 Day Resume Search</option
<option value="$200.00">90 Day Resume Search</option
</select

Using the drop down, I would also like to pass another variable i.e. 30,60,90 respectively (for days a user is allowed to search in the above example), ideally as a hidden field to the form as well.

Is it possible to do something like:

<select name="Resumes">
<option value="30,$100.00">30 Day Resume Search</option>
<option value="60,$150.00">60 Day Resume Search</option
<option value="90,$200.00">90 Day Resume Search</option
</select

Am I in the ballpark? If so, how would I get the 30, 60, 90 into a hidden field on the next page.

If I am not close, any ideas on how to do this?

Thanks Very Much in Advance
Joe

 
You can do that... you just have to parse the 2 values out of the 1 string.

In this example you can use either the comma or the dollar sign as the dividing point between the values.
 
Thanks...I'm clueless as to how to parse the 2 values...could you point me in the right direction?

Joe
 
Well it depends on what language you are using.

Suppose you are using VBScript... you might use the string functions such as Left(), Mid(), or Right() to parse the substrings. .... You could use the Instr() function to find the position of one or more characters within a string...you might also use the Split() function to break a string into an array.

So, which language are you using in your ASP?
 
To get the days, this example uses Left() and Instr():
MyDays = Left(Request("Resumes"), Instr(Request("Resumes"), ",") - 1)


To get the price, this one exes Mid() and Instr():
MyPrice = Mid((Request("Resumes"), Instr(Request("Resumes"), ",") + 1)


There is more than one way to skin this cat... just take a look at the VBScript string functions that I mentioned above and you can probably think of other combinations that will also work... or you can use Split() if you prefer.

 
1000 Thank You's....I'll give it a try.
Joe
 
could you also do a

Code:
resumes=split(Request("Resumes"),",")
MyDays = resumes(0)
MyPrice = resumes(1)
[code]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top