Skip to main content
Participating Frequently
May 31, 2009
Question

Create a variable

  • May 31, 2009
  • 2 replies
  • 461 views

I am trying to create a variable in CF8 but cant get the below to work because it doesnt like the tags in the variable. Please advise how I can make the below into one variable?
<cfset mydata="<message>#city#,#state#,#country#</message>">

I tried escaping the variable part but it gave me an error message:

<cfset mydata="\<message\>#city#,#state#,#country#\</message\>">

    This topic has been closed for replies.

    2 replies

    BKBK
    Community Expert
    Community Expert
    June 1, 2009

    Coldfusion has functions to escape tags. Two of them are

    <cfset mydata=htmleditformat("<message>#city#,#state#,#country#</message>")>
    <cfset mydata=xmlformat("<message>#city#,#state#,#country#</message>")>

    Inspiring
    June 1, 2009

    I'm guessing that your variable was created, but your browser won't display it because of the tag.  To test this theory, output it in a text box.