<%
'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