RequestToVar Function:
Retrieve all variables from each type of Request and assign variables to them
Description:
RequestToVar Function grab all variables from each type of Request and assign variables to them. You don't ever have to write every time: Dim var1, var2, var3, ... var1 = Request.Form("item1") var2 = Request.Form("item2") var3 = ...
Syntax:
RequestToVar(RequestType)
Details:
Argument: RequestType = "querystring", "form", "cookies" or "all"
Example:
<%
RequestToVar("form") '--- Put all values from form post into variables, names and Dim them with the form name
RequestToVar("querystring") '--- Put all values from querystring into variables, names and Dim them with the querystring name
RequestToVar("cookies") '--- Put all values from cookies into variables, names and Dim them with the cookies name
%>
ASP Source Code:
<%
Function RequestToVar(RequestType) '--- RequestType: querystring, form, cookies or all Dim VarString, item RequestType = lcase(RequestType) If RequestType = "querystring" or RequestType = "all" Then For Each item in Request.QueryString VarString = item & " = Request.QueryString(""" & item & """)" execute(VarString) Next End If If RequestType = "form" or RequestType = "all" Then For Each item in Request.Form VarString = item & " = Request.Form(""" & item & """)" execute(VarString) Next End If If RequestType = "cookies" or RequestType = "all" Then For Each item in Request.Cookies VarString = item & " = Request.Cookies(""" & item & """)" execute(VarString) Next End If End Function
%>
|