home *** CD-ROM | disk | FTP | other *** search
/ Australian Personal Computer 1999 April / APC443.iso / features / grpware / coldfus / coldfusi.exe / data1.cab / Documentation / snippets / setvariable.cfm < prev    next >
Encoding:
Text File  |  1998-10-08  |  1009 b   |  48 lines

  1. <!--- This example shows SetVariable --->
  2.  
  3. <HTML>
  4.  
  5. <HEAD>
  6. <TITLE>
  7. SetVariable Example
  8. </TITLE>
  9. </HEAD>
  10.  
  11. <BODY bgcolor=silver>
  12.  
  13. <H3>SetVariable Example</H3>
  14.  
  15. <CFIF IsDefined("form.myVariable")>
  16.  
  17. <!--- strip out url, client., cgi., session., caller. --->
  18. <!--- This example only lets you set form variables --->
  19.  
  20. <CFSET myName = ReplaceList("#form.myVariable#", "url,client,cgi,session,caller", "form,form,form,form,form")>
  21.  
  22.  
  23. <CFSET temp = SetVariable("#myName#", "#form.myValue#")>
  24.  
  25. <CFSET varName = myName>
  26. <CFSET varNameValue = Evaluate("#myName#")>
  27.  
  28. <CFOUTPUT>
  29.     <P>Your variable, #varName#
  30.     <P>The value of #varName# is #varNameValue#
  31. </CFOUTPUT>
  32.  
  33. </CFIF>
  34.  
  35. <FORM ACTION="setvariable.cfm" METHOD="POST">
  36. <P>Your variable name to set:
  37. <BR><INPUT TYPE="Text" NAME="myVariable" VALUE="form.something">
  38. <P>The value to set it to:
  39. <BR><INPUT TYPE="Text" NAME="myValue" VALUE="Test">
  40.  
  41. <INPUT TYPE="Submit" NAME="show me the result">
  42. </FORM>
  43.  
  44.  
  45. </BODY>
  46.  
  47. </HTML>       
  48.