I need help in trying to pass php variables from page to page, so that I know how my different advertising campaigns are doing?? Im new to php and don't know how to do this...thanks
help passing php variables
Collapse
X
-
-
Not sure exactly what you are trying to achieve but it may be something like this. You have many different pages pointing one place and want to see where the hits are coming from? If so, this example might give you a rough idea.
Many pages:
<a href="http://this.is.my/single/page.php?referrer=here">Link 1</a>
<a href="http://this.is.my/single/page.php?referrer=there">Link 1</a>
The one page:
<pre>
<?php
if ($_GET["referrer"])
{
echo "Referrer: ".$_GET["referrer"];
}
else
{
echo "Came without a referral";
}
?>
</pre>
Normally from within the if statement you would store the value in a database etc for future reference. Let me know if you need anymore help.
Comment
-
I actually want to pass them through the url...Here is what im trying to do: I have say 3 different advertisements pages (one.html?yahoo one.html?tgp one.html?linklist) and all of them will be advertising the same site..i just want to know how to pass on these variables through the sites tour until they hit the signup button? thanks guysComment
-
here's what i would do....
To get this:
tour1.php?from=yahoo
tour2.php?from=yahoo
tour3.php?from=yahoo
on the forms do this:
<a href='tour2.php?from=$from'>Next</a>
<a href='tour3.php?from=$from'>Next</a>
<a href='signup.php?from=$from'>Signup</a>
**EDIT**
**/EDIT**PHP Code:<a href='tour2.php?from=$from'>Next</a> <a href='tour3.php?from=$from'>Next</a> <a href='signup.php?from=$from'>Signup</a>
Or at least that's what I would do...you could try playing with cookies, but I wouldn't recommend it (but you could do it if you were trying to hide the "from=yahoo" part.
Let me know if that works for you!Last edited by AvanteGuard; 03-22-2004, 07:07 PM.Looking for Fast Professional Programming? http://www.imadigan.com
ICQ: 314-942-262 | MSN/Email: [email protected]Comment
-
-
Another option is to make use of sessions, which is specifically designed to track persistant data across requests to the same site (you didn't specify if the data had to be passed across multiple domains, or just different pages on the same domain)
http://www.php.net/manual/en/ref.session.php
should get you pointed in the right direction.~

Comment
-
I will need it for both...alot of my tgp galls will be on a different server than my paysite. So I will need to track this variable from my tgp.html?one over to my paysite and then through the tour pages to my signup page...just looking for something simple that works good. Do i need to change my php.ini? or do i just add this php code in my pages? thanks againComment

Comment