Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Looping Through request.Querystring


Message #1 by "Joseph A. Muldoon" <j_muldoon@m...> on Sat, 24 Aug 2002 18:07:30
This has GOT to be very simple, but I'm just not figuring it out.

I have a form in which the check boxes get their names from the number of 
Subjects in the PhotoSubject table. It increments like this:

<Input type=checkbox name='" & cellcount & "'"

I do it this way so the user can change the Number of Subjects anytime.

The response form uses a corresponding loop and adjusts a join table 
accordingly. This is working very reliably, but I am using Select Case in 
the reponse form because I haven't fugured out how to get the following to 
loop:


	For cou = 0 to couSu
	
		currSuId= allSu(0,cou) ' Used  NOT in this loop but in SUB 
Changes, which is called by this loop		
		suName= allSu(1,cou)
		cou2=cou+1
		'Re the numbers:  cou has to start at 0 because we need to 
start there for the array.
						' cou2 is created to match 
the numbering system of incoming form. It is
						' set up so that number 1 
corresponds to the first subject (which is 0,0 in the array.
	


				if Request.QueryString(cou)="on" then	' 
When checkbox has "CHECKED", request will read "on"
								blnOn=1
				else
				blnOn=0
				end if
				call changes

I need the NAME of the checkbox to increase with each loop.

Thanks for any assistance
Message #2 by boryan@s... on Sat, 24 Aug 2002 19:22:45
Use 'for' loop

For each fld in request.guerystring
response.write fld & ": " & request(.querystring(fld) & "<br>"
next

You can use the same technics for request.form

Good luck!
Message #3 by Berkay Mese <berkaymese@y...> on Sat, 24 Aug 2002 18:31:16 -0700 (PDT)
 Joseph,
 You can get the form elements' values posted,as
follows:

   Dim itemVal, chkboxArr
   For each item in request.QueryString
        itemVal = request.QueryString(item)
        response.write item & ":" & itemVal & "<BR>"
        If itemVal = "on" Then
          '  your code..
        End If
   Next

 Berkay


--- "Joseph A. Muldoon" <j_muldoon@m...> wrote:
> This has GOT to be very simple, but I'm just not
> figuring it out.
> 
> I have a form in which the check boxes get their
> names from the number of 
> Subjects in the PhotoSubject table. It increments
> like this:
> 
> <Input type=checkbox name='" & cellcount & "'"
> 
> I do it this way so the user can change the Number
> of Subjects anytime.
> 
> The response form uses a corresponding loop and
> adjusts a join table 
> accordingly. This is working very reliably, but I am
> using Select Case in 
> the reponse form because I haven't fugured out how
> to get the following to 
> loop:
> 
> 
> 	For cou = 0 to couSu
> 	
> 		currSuId= allSu(0,cou) ' Used  NOT in this loop
> but in SUB 
> Changes, which is called by this loop		
> 		suName= allSu(1,cou)
> 		cou2=cou+1
> 		'Re the numbers:  cou has to start at 0 because we
> need to 
> start there for the array.
> 						' cou2 is created to match 
> the numbering system of incoming form. It is
> 						' set up so that number 1 
> corresponds to the first subject (which is 0,0 in
> the array.
> 	
> 
> 
> 				if Request.QueryString(cou)="on" then	' 
> When checkbox has "CHECKED", request will read "on"
> 								blnOn=1
> 				else
> 				blnOn=0
> 				end if
> 				call changes
> 
> I need the NAME of the checkbox to increase with
> each loop.
> 
> Thanks for any assistance


__________________________________________________
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com
Message #4 by "Joseph A. Muldoon" <j_muldoon@m...> on Sun, 25 Aug 2002 17:33:00
Berkay and ""boryan@"

Thanks for the timely response. I've tweaked the code using your examples 
and am am pretty sure I have it right. Now I see had some "loopy" logic 
between my inner loop and outer loop and ought to be able to fix that one 
pretty quick.

Great forum.

Joe

>  Joseph,
 You can get the form elements' values posted,as
follows:

   Dim itemVal, chkboxArr
   For each item in request.QueryString
        itemVal = request.QueryString(item)
        response.write item & ":" & itemVal & "<BR>"
        If itemVal = "on" Then
          '  your code..
        End If
   Next

 Berkay


--- "Joseph A. Muldoon" <j_muldoon@m...> wrote:
> This has GOT to be very simple, but I'm just not
> figuring it out.
> 
> I have a form in which the check boxes get their
> names from the number of 
> Subjects in the PhotoSubject table. It increments
> like this:
> 
> <Input type=checkbox name='" & cellcount & "'"
> 
> I do it this way so the user can change the Number
> of Subjects anytime.
> 
> The response form uses a corresponding loop and
> adjusts a join table 
> accordingly. This is working very reliably, but I am
> using Select Case in 
> the reponse form because I haven't fugured out how
> to get the following to 
> loop:
> 
> 
> 	For cou = 0 to couSu
> 	
> 		currSuId= allSu(0,cou) ' Used  NOT in this loop
> but in SUB 
> Changes, which is called by this loop		
> 		suName= allSu(1,cou)
> 		cou2=cou+1
> 		'Re the numbers:  cou has to start at 0 because we
> need to 
> start there for the array.
> 						' cou2 is created to match 
> the numbering system of incoming form. It is
> 						' set up so that number 1 
> corresponds to the first subject (which is 0,0 in
> the array.
> 	
> 
> 
> 				if Request.QueryString(cou)="on" then	' 
> When checkbox has "CHECKED", request will read "on"
> 								blnOn=1
> 				else
> 				blnOn=0
> 				end if
> 				call changes
> 
> I need the NAME of the checkbox to increase with
> each loop.
> 
> Thanks for any assistance


__________________________________________________
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com

  Return to Index