How to set a variable with name and value in ColdFusion

SetVariable() - set a variable with name and value

SetVariable.cfm


<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>SetVariable function example: how to set a variable with name and value</title>
</head>

<body>
<h2 style="color:Crimson">SetVariable Function Example</h2>

<cfset MyID=5>
<cfset Setvariable("ID" & MyID,"Jones" )>
<cfset SetVariable("City","Rome")>
<cfoutput>
 <b>ID5:</b> #ID5#
 <br />
 <b>City:</b> #City#
</cfoutput>

</body>
</html>






More ColdFusion examples