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

Variable not holding value

Status
Not open for further replies.

craiogram

MIS
Feb 20, 2004
126
US
This may be a conceptual issue.
Overview: Form has checkboxes. Click submit and get to this page to process. As this code checks the checkboxes I need a value of "SOLD" to be held in it's own variable associated to it's checkbox(of which 1 and 3 are currently checked and checkbox names are A1-A3).

Code:
dim uColHldAll, uColHld1, uColHld12, uColHld3, cellID

for i=1 to 3
cellID = "A" & i

if Request.Form(cellID)="on" then 
uColHldAll = "uColHld" & i              '<--In run 1 should have uColHld1
    Response.Write(uColHldAll & "<BR>") '<--Shows "uColHld1"
uColHldAll = "SOLD"           '<--In run 1 should set uColHld1 = "SOLD"
Response.Write(uColHldAll & "<BR>")     '<--Shows "SOLD"

Response.Write(uColHld1)	        '<--Should show me "SOLD"

end if
next
Reason for putting each "SOLD" value in it's own variable is because I will later update a database with each value therefore I need each seperate value.

Thank you in advance!!
 
When you wish a varible to have a value, you must assign a value to it.

I dont see anyline of code that has assigned a value to the variable uColHld1.
 
Thank you for the response rac2 but I was under the impression that when I used this line:
Code:
uColHldAll = "SOLD"
Alhough it is literally uColHldAll but it is holding uColHld1. I guess it's a value as opposed to a variable. Maybe passing the reference point(memory location).hmmm.

I think I may have to reevaluate this and perhaps incorporate an array.

Thanks again.
 
Yes it is a value.

Given the assignment:
[tt]uColHldAll = "uColHld" & i [/tt]

Assuming that i has a value of 1, the value of uColHldAll is "uColHld1" ... not the variable of the same name.

VBScript doesn't have native support for memory manipulation... an array would be much better... even the arrays are not arrays, or at least not in the C language sense of the term "array."
 
>[tt]Response.Write(uColHldAll & "<BR>") [/tt]
This would do.
[tt]Response.Write([red]eval([/red]uColHldAll[red])[/red] & "<BR>")[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top