devxlogo

Convert Form Collection into a String

Convert Form Collection into a String

You can convert the entire Request.Form collection into a single string variable just by referencing the collection without specifying the key or index.

The format of the string would look like as follows:

 KeyName1=KeyValue1&KeyName2=KeyValue2&....

Basically the string would contain all the name/value pairs where each name/value pair is separated from the others with an ampersand (&) character. This is useful if you want to cache the entire collection in some hidden field for future processing.

If you have following form declaration in your ASP page:

 
Work Phone:Home Phone:

Then this code would convert the Form collection into a string variable when the user clicked on the submit button.

 <%Dim strFormCollection' this call will convert the entire collection ' into a string.strFormCollection = Request.Form' format of strFormCollection would look like' WorkPhone=111222333&HomePhone=444555666%>

devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist