Whatever message this page gives is out now! Go check it out!
SetVariable(name, value) |
Parameter | Description |
name | Variable name |
value | A string, the name of a string, or a number |
<cfset "#DynamicVar2#" = "Test Value2"> |
<cfset "myVar#i#" = myVal> SetVariable("myVar" & i, myVal) |
<h3>SetVariable Example</h3>
<cfif IsDefined("FORM.myVariable")>
<!--- strip out url, client., cgi., session., caller. --->
<!--- This example only lets you set form variables --->
<cfset myName = ReplaceList(FORM.myVariable,
"url,client,cgi,session,caller", "FORM,FORM,FORM,FORM,FORM")>
<cfset temp = SetVariable(myName, FORM.myValue)>
<cfset varName = myName>
<cfset varNameValue = Evaluate(myName)>
<cfoutput>
<p>Your variable, #varName#
<p>The value of #varName# is #varNameValue#
</cfoutput>
</cfif>