Skip to main content
Inspiring
November 18, 2008
Question

Passing an ID in a URL as a variable

  • November 18, 2008
  • 4 replies
  • 633 views
I am trying to do the following...

Take a URL www.site.com and append it with www.site.com/index.cfm?id=3 where id can really equal any number.

I can do this and pass the data on the same page like so

REFER TO ATTACHED CODE PLEASE...

This will work in the scope of the page I have it written. What I am doing is adding the subject with the addition of a number to very some email for marketing.

I am using the same template form to have users fill out and then <CFMAIL> to send the mail out with #subject# being pulled from the page that I have CFSET the URL.ID. If I do a <CFSET subject="this is the email subject"> without the URL.ID things work fine.

Is there any way I can pass the URL.ID number to my template to correctly label my subject line?

Thanks!
Dave
    This topic has been closed for replies.

    4 replies

    tclaremont
    Inspiring
    November 19, 2008
    I am with Ian on this one. We need a better explanation of what is going on.


    If you use the following:
    www.site.com/index.cfm?id=3&URL.ID=#URL.ID#

    Do you get an error? Variable not defined? What is the failure mode?
    Inspiring
    November 18, 2008
    > I will get 5. The problem is when I try to pass that as the a variable called
    > subject to an email it does not work.
    >

    How are you passing it has a subject to an email?

    <cfmail ... subject="Something is #url.id#" ...> has always worked for me.
    Inspiring
    November 19, 2008
    That's right I am doing something similar. subject="blah blah #URL.id#." but I am trying to pass this variable #Subject# through an CFINCLUDE of my form / email template.
    Inspiring
    November 18, 2008
    tclaremont your idea did not work for me. I can actually get a variable number by appending like so www.site.com?id=5 where 5 is the number I assigned to the page. I can then get that to show as output like

    <CFOUTPUT>
    Here is the number #URL.id#
    </CFOUTPUT>

    I will get 5. The problem is when I try to pass that as the a variable called subject to an email it does not work.

    Dave
    tclaremont
    Inspiring
    November 18, 2008
    Although using variables in a URL is not really recommended, will this work?

    www.site.com/index.cfm?id=3&URL.ID=#URL.ID#