Weird logic result reversing x & i variables.

# Thread: Weird logic result reversing x & i variables.

1. Senior Member
Join Date
Dec 1969
Posts
182

## Weird logic result reversing x & i variables.

This is weird: reversing the x and i varibles in the endStr changes the value of pric11. If it is as i have it now, then I get values for 11, 12, 13, but no value for pricey. If I change x and i around in the endStr, then I get 11, 21, 31 AND I get a value for pric11. Why don&#039;t I get a value for pric11 when the x and i are reversed?! The value is still 11. Why? I need results for endStr as I have it now. The fields are pric11, pric12, pric13 -- etc.<BR> <BR>x=1<BR>for i=1 to columncount<BR><BR>endStr=cstr(x)&cstr(i)<BR>price y = (request.form("pric"&endStr))<BR> <BR>response.write (endStr)<BR>response.write (pricey)<BR>next

2. Senior Member
Join Date
Dec 1969
Posts
5,104

## Change these lines...

response.write (endStr & "&#060;br /&#062;")<BR>response.write (pricey & "&#060;br /&#062;")<BR>response.write ("&#060;br /&#062;")<BR><BR>And copy that output to a post.<BR><BR>-Doug

3. Senior Member
Join Date
Dec 1969
Posts
182

## RE: Change these lines...

endStr=cstr(x)&cstr(i) gets:<BR><BR>11<BR>12<BR>13<BR> <BR>endStr=cstr(i)&cstr(x) gets<BR>11<BR>21<BR>11111<BR>1111131<BR><BR>for the endStr=cstr(x)&cstr(i),<BR>the values should be<BR>11111<BR>22222<BR>33333<BR>

4. Senior Member
Join Date
Dec 1969
Posts
5,104

## Apples & Oranges...

I&#039;m not sure what code you ran and what the results were.<BR><BR>Run this code and give me the EXACT UNCHANGED results:<BR>x=1 <BR>for i=1 to columncount <BR><BR>endStr=cstr(x)&cstr(i) <BR>pricey = (request.form("pric"&endStr)) <BR><BR>response.write (endStr & "//" & pricey & "&#060;br /&#062;" & vbCRLF) <BR>response.write ("&#060;br /&#062;")<BR>next<BR><BR>-Doug

5. Senior Member
Join Date
Dec 1969
Posts
182

## RE: Apples & Oranges...RESULTS

11//<BR><BR>12//<BR><BR>13//<BR>

6. Senior Member
Join Date
Dec 1969
Posts
5,104

## X&Y code is fine...

What are you form fields named?<BR><BR>You are asking for:<BR>Request.Form("pric11")<BR>Request.Form("pr ic12")<BR>Request.Form("pric13")<BR><BR>If you do:<BR>For oFLD In Request.Form<BR> Response.Write oFLD & ": " & Request.Form(oFLD) & "&#060;br /&#062;" & vbCRLF<BR>Next<BR><BR>Your problem isn&#039;t in the X&Y being switched.

7. Senior Member
Join Date
Dec 1969
Posts
182

## Thanks -- now to locate the problem with my brain

Thanks, you got it figured out for me.<BR><BR>

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•