AnaFyr
11-03-2003, 09:24 PM
I need help trying to capture a value from a form that originates as a <SELECT> statement. Upon posting the form, I like to capture the data and store this into a variable that I can use later on in the script.
I'm currently returning a value to the ASP compiler via a Select Option on the Form.
<SELECT NAME="SelectNumberWeights">
<OPTION VALUE="1" SELECTED>1
<OPTION VALUE="2">2
<OPTION VALUE="3">3
<OPTION VALUE="4">4
<OPTION VALUE="5">5
<OPTION VALUE="6">6
<OPTION VALUE="7">7
<OPTION VALUE="8">8
<OPTION VALUE="9">9
<OPTION VALUE="10">10
</SELECT>
I'm capturing this information on the "called".asp Page.
Dim NumberOfWeights
NumberOfWeights = Request.Form ("SelectNumberWeights")
I have to set a price for each Option Value on the Form. I wanted to create a Function that could check the Value from the Form and according to it's value, set a variable to a chosen number.
By using the code above as an example:
IF "NumberOfWeights" variable is equal to "1" THEN
Set varExampleVariable to a certain price. By this I mean I want to set the variable with an Integer type.
I don't quite understand the scope of the Function declaration. I realize the point of naming the Function and declaring an implicit variable to capture the returning "value".
eg: Function FunctionName (varNewVariable)
I believe I need to execute an IF statement, or Select statement to see what the user selected; and according to that, set a specific price. Set it to a variable I can use later on in the script to manipulate with math operators.
I've tried a few different things including nested statements, but not sure if I really have it right. I know this can be done, I'm just too limited. HELP!
I'm currently returning a value to the ASP compiler via a Select Option on the Form.
<SELECT NAME="SelectNumberWeights">
<OPTION VALUE="1" SELECTED>1
<OPTION VALUE="2">2
<OPTION VALUE="3">3
<OPTION VALUE="4">4
<OPTION VALUE="5">5
<OPTION VALUE="6">6
<OPTION VALUE="7">7
<OPTION VALUE="8">8
<OPTION VALUE="9">9
<OPTION VALUE="10">10
</SELECT>
I'm capturing this information on the "called".asp Page.
Dim NumberOfWeights
NumberOfWeights = Request.Form ("SelectNumberWeights")
I have to set a price for each Option Value on the Form. I wanted to create a Function that could check the Value from the Form and according to it's value, set a variable to a chosen number.
By using the code above as an example:
IF "NumberOfWeights" variable is equal to "1" THEN
Set varExampleVariable to a certain price. By this I mean I want to set the variable with an Integer type.
I don't quite understand the scope of the Function declaration. I realize the point of naming the Function and declaring an implicit variable to capture the returning "value".
eg: Function FunctionName (varNewVariable)
I believe I need to execute an IF statement, or Select statement to see what the user selected; and according to that, set a specific price. Set it to a variable I can use later on in the script to manipulate with math operators.
I've tried a few different things including nested statements, but not sure if I really have it right. I know this can be done, I'm just too limited. HELP!