asp tutorials, asp.net tutorials, sample code, and Microsoft news from 15Seconds
Data Access  |   Troubleshooting  |   Security  |   Performance  |   ADSI  |   Upload  |   Email  |   Control Building  |   Component Building  |   Forms  |   XML  |   Web Services  |   ASP.NET  |   .NET Features  |   .NET 2.0  |   App Development  |   App Architecture  |   IIS  |   Wireless
 
Pioneering Active Server
 Power Search





Active News
15 Seconds Weekly Newsletter
• Complete Coverage
• Site Updates
• Upcoming Features

More Free Newsletters
Reference
News
Articles
Code Samples
Components
Tools
New
Free
Downloads
Vendors
FAQ
Feedback
Books
Links
DL Archives
Community
Messageboard
List Servers
Mailing List
WebHosts
Consultants
Tech Jobs
15 Seconds
Home
Site Map
Press
Legal
Privacy Policy
internet.commerce














internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers

HardwareCentral
Compare products, prices, and stores at Hardware Central!

<%
'The First Function-'ReadFormVariables' can be used in place of the very common:
'var1=request.form("var1")
'var2=request.form("var2")
'var3=request.form("var3")
'var4=request.form("var4")
'var5=request.form("var5")
'....etc
'You simply now just call the function, and all vbscript values are set to match those
'posted from a form.  This sounds great, and it is but the vbscript variables that are named
'identically to the form variable names (this is usually a good thing) 
'If for example a form contained a text box that is named 'Surname', 
'and after submitting the form, the following page called upon the 'ReadFormVariables'
'function, VBScript would now have access to a variable called Surname containing the value
'of whatever the user entered into the textbox. It will loop through ALL form variables.
' 
'The Second Function-'SendHiddenFormFields' is very useful for those occasions where
'you need to read in all the form values, and include them within another form as
'hidden fields.  Reasons to this could include multiple page forms and also when a user
'enters data incorrectly on a form, and you want to post the data back for editing, etc

	Sub SendHiddenFormFields ()
		For Each Field In Request.Form
			TheString="<input type=""hidden"" name=""" & Field & """ value="""
			Value=Request.Form(Field)
			Thestring=TheString + cstr(Value) & """>" & vbcrlf
			Response.Write TheString
		Next
	END Sub
	
	Sub ReadFormVariables()
		For Each Field In Request.Form
			TheString = Field & "=Request.Form(""" & Field & """)"
			If eval(TheString) Then 
				Execute(TheString)
			Else
				Response.Write "Internal Error (ReadFormVariables Function)"
			End if
		Next
	END Sub
%>

Submitted by Robert Collyer



email this code sample to a colleague




Support the Active Server Industry

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs