Reply
ColdFusion: onload pass a variable via query string
Old 10-13-2009, 04:52 PM ColdFusion: onload pass a variable via query string
ericson3000's Avatar
Average Talker

Posts: 24
Name: Marty
Location: Los Angeles, CA
Trades: 0
Hey guys - I have a form on a page that creates a coupon code (something like 879COUPON) and emails it to the user when they submit the form. They are also taken to a thank you page after submitting the form.

What I want is to pass the variable (879COUPON) via query string to an outside URL (www.notmysite.com?id=879COUPON) when the thank you page loads.

I use ColdFusion to generate the code, so is there a ColdFusion way to automatically send the query string when the second page loads? Or do I need to do some kind of ColdFusion/JavaScript hybrid?
ericson3000 is offline
Reply With Quote
View Public Profile
 
 
When You Register, These Ads Go Away!
Old 10-13-2009, 05:24 PM Re: ColdFusion: onload pass a variable via query string
chrishirst's Avatar
Super Moderator

Posts: 22,221
Location: Blackpool. UK
Trades: 0
very rusty with CF not used it in a good many years (happily)
Code:
<cfset>remoteurl = "othersite.tld?id="</cfset>
<cfset>coupen="879COUPON"<cfset>

<cfoutput><a href=#chr(34)##remoteurl##coupen##chr(34)#>Anchor Text</a></cfout>
Or something like that
May have got my quotes and literals mixed up though, CF is not something I kept up with. I was hoping never to use it ever again!
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Growing old is mandatory - Growing up is optional
Code Samples | People Counting System | Bits & Bobs
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 10-13-2009, 05:35 PM Re: ColdFusion: onload pass a variable via query string
ericson3000's Avatar
Average Talker

Posts: 24
Name: Marty
Location: Los Angeles, CA
Trades: 0
Thanks chrishirst!

This is an excellent start for me. I rarely need to use CF, but I know what you mean. I hate using it.

One more question: is there a way to not output a link, but to have the link and query string automatically sent when the page loads?
ericson3000 is offline
Reply With Quote
View Public Profile
 
Old 10-13-2009, 05:44 PM Re: ColdFusion: onload pass a variable via query string
chrishirst's Avatar
Super Moderator

Posts: 22,221
Location: Blackpool. UK
Trades: 0
There is but I can't recall offhand how to request a remote URI with CF

<cfhttp> figures in there somewhere though

might have go delving in the dark recesses of my programming archives
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Growing old is mandatory - Growing up is optional
Code Samples | People Counting System | Bits & Bobs
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 10-13-2009, 06:08 PM Re: ColdFusion: onload pass a variable via query string
ericson3000's Avatar
Average Talker

Posts: 24
Name: Marty
Location: Los Angeles, CA
Trades: 0
Thanks for putting me on the right trail. Appreciate your time. I'll look into it.
ericson3000 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to ColdFusion: onload pass a variable via query string
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 



Page generated in 0.11441 seconds with 13 queries