![]() |
help passing php variables
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
|
www.php.net :thumbsup
|
Do you mind passing these via the URL or is this something you don't want shown?
|
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. :thumbsup |
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 guys
|
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** PHP Code:
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! |
What JamesDotCom said. There are other ways but that is nice and easy.
|
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. |
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 again
|
can someone clue me in on how to do
xxx.html?something rather than xxx.html?var=something ive seen it used a lot but never used it myself. thanks in advance :thumbsup |
bump......would also like to know how to do this: index.html?yahoo
thanks again |
All times are GMT -7. The time now is 01:28 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123