Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Get value out of cookie and pass in form field
Old 02-09-2010, 05:58 PM Get value out of cookie and pass in form field
Skilled Talker

Posts: 62
Name: Andrew
Trades: 0
I'm new to this so I think this is the correct place to post this. I have an affiliate program that creates cookies from the referring sites, and when a visitor arrives on my site, the cookies pass through variables which allow the software on my site to track sales (affiliate id, etc).

I'm trying to figure out how to extract the values (such as aff_id) and have this value submitted as a hidden field on a custom form. Any suggestions on how to get started with this. I know how to create hidden form fields, but I'm at a lost with the rest. Also, my site is on php pages. I've been searching but haven't been able to find anything that helps yet.
andrew99 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-09-2010, 06:01 PM Re: Get value out of cookie and pass in form field
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Your site cannot read cookies created by a different site.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 02-09-2010, 06:18 PM Re: Get value out of cookie and pass in form field
Skilled Talker

Posts: 62
Name: Andrew
Trades: 0
Maybe I understood it wrong. I have affiliate links on other sites put there by our affiliates. We have the affiliate program software located on our site. So when a visitor comes into my site from one of our links, maybe the cookie is created then (by my program). Is this the likely scenario?

I'm assuming the affiliate id is in a cookie when the visitor is browsing our site, because they can purchase at various points and the affiliate commission is still tracked. I also have a code snippet that displays the affiliate id (in the web text) to the visitor anywhere on my website:

<script language="JavaScript" type="text/javascript" src="http://www.mysite.com/partner/display.php"></script>

Taking this into account, is it possible to pull the affiliate id off of this snippet and send it through a hidden form field on the same page? Thanks for any suggestions.
andrew99 is offline
Reply With Quote
View Public Profile
 
Old 02-09-2010, 06:31 PM Re: Get value out of cookie and pass in form field
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
The affiliate ID will probably be sent to your site in the URL eg yoursite.tld?affid=idcode and as you surmise, your site code will read the ID and save it in a cookie with a set lifetime.

http://www.w3schools.com/PHP/php_cookies.asp you need to read out the value and put it into the form field.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 02-09-2010, 08:00 PM Re: Get value out of cookie and pass in form field
Skilled Talker

Posts: 62
Name: Andrew
Trades: 0
Thanks. I went to that page before I ever made this post. I tested it but couldn't make anything out of the printed cookie values. They are several cookies and they were all long strings of text. If the affiliate id was in there, it must have been scrambled. My guess is the affiliate program is able to decode the stuff in the cookie and then somehow translate an affiliate id out if it (which I have no clue how to do).

It would be great if I could do something with that code snippet from my earlier post. It prints the id right out on the page (anywhere on my site), so it seems like there could be a relatively easy way to pull the value out of the snippet to pass through a hidden form field.

I'll keep searching but let me know if anyone has ideas on where to go from here. Thanks.
andrew99 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Get value out of cookie and pass in form field
 

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.27569 seconds with 12 queries