Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Web
Expertise: Beginner
Jun 5, 2000

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:

 
<FORM ACTION="PhoneSample.asp" METHOD="POST">
Work Phone:<INPUT TYPE="TEXT" NAME="WorkPhone"></INPUT>
Home Phone:<INPUT TYPE="TEXT" NAME="HomePhone"></INPUT>
<INPUT TYPE="SUBMIT" NAME="bttnSubmit" VALUE="SUBMIT"></INPUT>
</FORM>
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

%>

Deepak Pant
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date