Gossamer Forum
Home : General : Perl Programming :

passing names from select fields

Quote Reply
passing names from select fields
Hi,

Hope everyone had a good holiday. I'm wondering if this is possible. Ok....what I'm trying to do is pass both the select field "text names".. and values......if at all possible. I'll give an example. Here's a select field I have.

<select name="amount">
<option value="10">name 1
<option value="20">name 2
<option value="30">name 3
<option value="40">name 4
</select>

So if the user chooses name 1 the value that's going to be passed on is 10. Ideally, I would like for both the value 10 and the name name 1 to be passed....but obviously name 1 isn't a value, so here's where I'm stuck. Now, I can't use "name 1" as the value, because I need the amount of 10 for caculations. Is this possible without creating another input/select form that the user needs to fill out? If it was just one field it wouldn't be a problem, but I have several fields and options and it doesn't make sense to have 2 options for each field (one printing the name and the other printing the value).....this could cause problems anyway, if the user mistakenly chose name 1 and name 2. I wonder if javascript would do it? Anyway, if anyone knows any special tricks or has any suggestions on how to go about this, I would love to hear em. Thanks, and have a great New Year!

Quote Reply
Re: passing names from select fields In reply to
Well, ok I figured out a solution...., but thanks for taking the time to read. Basically I'm using hidden fields and if else statements. Seems to be working ok...just alot more input than I'd like. Thanks.