Click to See Complete Forum and Search --> : two variables in one SELECT


ozpo1
12-09-2005, 04:11 PM
My question is if it possible to save two variables in one select method, and post both of the variables on submit.

Example, if a user will choose Math in the following code, I want the value of category to be posted, but I want to send another variable, let say name="mathb", with it. is it possible to do it with no JS? and if not, how to do it with JS?

<form name="step1" action="http://localhost/Test.asp" method="post">
<b>Choose Category:</b>
<select name="Category" name1="dbcategory">
<option value="Math" value1="Math">Mathl</option>
<option value="English">English</option>
</select>
<br /><br />
<input type="submit" value="Next Step"/>

Thanks in Advanced. Oz.

the tree
12-10-2005, 05:13 AM
Really, why on earth would you want to do this? Couldn't you just use the same variable twice?

Fang
12-10-2005, 05:14 AM
Use a delimiter between the values in value:value="val1,val2" Check server-side for the delimiter to seperate the values.

ozpo1
12-11-2005, 02:49 PM
and just for you know, I want a do it, because this variable is the name of one of my database, and also I want to use it a title. (and the problem is that in mysql names can be only one word. So this way I can't use it as title, or can't use it as table name.

Fang
12-12-2005, 04:37 AM
The form will only pass the value in value, any other attributes will not be sassed.
Another solution is to use hidden fields.