Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: RE: Order of items in querystring do not match


Message #1 by "John Wm. Wicks" <j_wicks@p...> on Wed, 29 Aug 2001 17:41:34 -0700
Hello Joe,



A construct I use a lot for forms involves using the dictionary object where

the key is the fieldname and the item is the display text on the form. I

also try to use fieldnames in my forms that match my database field names if

I'm storing the data. So for your example I'd create the following

dictionary where both ASP pages could see it...



dim dctMyForm1

set dctMyForm1 = Server.CreateObject("Scripting.Dictionary")

dctMyForm1.add "FirstName","First Name:"

dctMyForm1.add "LastName","Last Name:"

etc...



Now just change the for each to use the dictionary instead of

request.querystring



' dctMyForm1.keys does roughly the same thing

' as the split example from Steve but you maintain

' only the one dictionary object

for each key in dctMyForm1.keys

	fldVal = request.querystring(key) & ""

	msgTxt = msgTxt & key & ": " & vbCrLF

	' or if you want more Human readable text

      ' use the next line instead of the previous one

	' msgTxt = msgTxt & dctMyForm1.Item(key) & "" & vbCrLF

	if fldVal = "" then

		msgTxt = msgTxt & "Nothing Listed<br>" & vbCrLF

	else

		msgTxt = msgTxt & fldVal & "<br>" & vbCrLF

	end if

	response.write msgTxt

next



Using the dictionary during form creation I created a series of wrapper

functions for the HTML form input types so you'll have to wing it for

creating your form...



John



> -----Original Message-----

> From: <jmuldoon@q...>

> To: "ASP Databases" <asp_databases@p...>

> Sent: Tuesday, August 28, 2001 8:40 PM

> Subject: [asp_databases] Order of items in querystring do not

> match the

> order of items written via For Each...Next loop

>

>

> : Problem is I am sending a querystring to an ASPMail form.

> The order that

> : the String items are sent is not the same order that The

> items are written

> : using a For Each...Next Loop.

> :

> : Here's the querystring that the form sends. I put a break

> before each

> : ampersand just to make the order of the items immediately clear:

> :

> : http://www.nonicnow.net/MinnCS/LimoMailSend.asp?

> : FirstName=Joe&

> : LastName=Muldoon

> : &EmailSddress=jGreg@q...

> : &PhoneNumber=612-823-3435

> : &Address=4322+Pearson+Avenue

> : &City=Minneapolis

> : &DateOfPickup=8%2F30

> : &TimeOfPickup=3+pm

> : &NumberOfPeople=6

> : &GoingTo=St.+Paul+Airport

> : &ExtraStops=Hilton

> : &Submit=Make+Your+Reservation




  Return to Index