Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Passing an ID in a URL as a variable

Explorer ,
Nov 18, 2008 Nov 18, 2008
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
566
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Nov 18, 2008 Nov 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#
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 18, 2008 Nov 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
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 18, 2008 Nov 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.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 19, 2008 Nov 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.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Nov 19, 2008 Nov 19, 2008
LATEST
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?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources