Hi all, can anyone here please explain how I would make this work? Not heavily into php but I'm getting hooked. I have a set of web pages that are pulling in by "php includes" areas of the page. To make up my page, pretty simple. I have a file called header.php which has all the header detail, meta tags, title tags and down to body tag. This works fine as I just put an <?php include("includes/header.php");?> Code (markup): in all my pages that call the header. Now at the very top of every one of my web pages I have to have: <?php $seedvar=$_GET['id'];?> Code (markup): Now I tried just putting at the top of my header.php page like this: <?php $seedvar=$_GET['id'];?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="robots" content="index, follow"> Code (markup): But of course it did not work. I then tried: <?php echo <?php $seedvar=$_GET['id'];?>;?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="robots" content="index, follow"> Code (markup): That did'nt work either. Neither did adding "<?php $seedvar=$_GET['id'];?>" quotes around it. So I would really appreciate it if someone could explain this for me. Thank you Regards Mike
What are you doing with $seedvar? does the page display a parse error when you run it? to me, it just appears that you're getting id, and saving the data in a variable... it doesn't appear that you're using the data to any extent.
Thanks for your quick reply. I'm using <?php $seedvar=$_GET['id'];?> Code (markup): to carry data 'id' to other pages on my site and ultimately to another web site for log analysis. I just need <?php $seedvar=$_GET['id'];?> Code (markup): at the top of all my pages. And as my headers come from php includes I guess I gotta shove it in there somehow. If it does not have to go into header.php how else do I get it in the top of my pages. Thanks Just to add that the refering page to my site will carry this data 'id' that I need to pass along.
Explain this bit in more detail and we might be able to help you in php variables do not remain in memory when you go from one page to another. for this to happen you need to use somthing like sessions, cookies or a database... maybe that helps?
It's ok I got it figured. It's so easy when you walk away and forget all about it. The answer just popped into my head. Thanks anyway
ads2help, Thanks for your reply. Basically, it is for tracking purpose.. 1) www.example.com/index.php?id=10 2) I would like to capture the id=10 (as above) into a php page. Hence, I include the code below into the php page before the <html> tag <?php $seedvar=$_GET['id'];?> However, whenever I save the php page and reopen it, the code is not there anymore. Did I miss out any steps?
actually i am not very sure what you mean by that. but just to let u know : by having this : $seedvar=$_GET['id']; You are only assigning a value($_GET['id']) to $seedvar, not printing out the $_GET['id'] value
ads2help, yes, you are right. the intention is the print the value to a Clickbank affiliate link http://myid.vendorid.hop.clickbank.net/?tid=<?php echo $seedvar;?> Hence, the flow is to pass the id=10 from www.example.com/index.php?id=10 and store it in $seedvar. However, I am not able to save the code of <?php $seedvar=$_GET['id'];?> to the index.php page before the <html> code. After I save the code into index.php and reopen it, the code is not there. How can I work this out? Please advice.
Hi I'm responding to your email. You will not see the code: <?php # Grab the source 'id' $seedvar=$_GET['id']; ?> Code (markup): in your page. The server executes it and strips it out. But it will still do its job. To check this just echo the $seedvar on your page and you will see if it is carried over. Regards Mike
u mean when u open the file using your php/text editor the <?php $seedvar=$_GET['id'];?> is not there? if it is, it is kinda weird =( or you mean the html source after loading index.php?
Hi, I am new to php code and have a couple of questions to ask. I have a landing page with the following code on top. <?php $seedvar=$_GET['id']; ?> Then a link on the landing page - http://www.mysite.com/link -----> this links to my index.php which in turn links to my clickbank product page. The code on the index.php looks like this <?php $seedvar=$_GET['id']; $link = "http://myid.productid.clickbank.net/?tid=".$seedvar; header("Location: $link"); ?> I just wanted to know how to test if this code is right and whether the tid value will be picked up by clickbank? Correct me if I am wrong, from what I understand the sequence is as follows 1. link to my landing page ----> http://www.mysite.com/site.php?tid=50 2. someone clicks on link (tid "50" is stored) -----> http://www.mysite.com/link 3. tid "50" stored in index.php 4. tid "50" sent to clickbank when order is made Thanks, Jack
all that code does is redirect you to "http://myid.productid.clickbank.net/?tid=50" or whatever you put as id. What exactly do you want to do? remember the 50 on pages that do not have the 50? You would need to use cookies or sessions for that, like so: <?php session_start(); $seedvar=$_GET['id']; //if the id may only be a number, you might want to cast it to be an integer or use intval() on it $_SESSION['seedvar'] = $seedvar; $link = "http://myid.productid.clickbank.net/?tid=".$seedvar; header("Location: $link"); ?> as long as you initiate the session on your pages, $_SESSION['seedvar'] will be available on all pages
The landing page is a website for a recommendation for a clickbank product. There are around ~5-6 links on the landing page. I did not want to place a direct link because I wanted to cloak it by first redirecting to the index.php. My goal is just to store the tid link from the a google adwords ad into my site then pass it onto the clickbank landing page, nothing else. Maybe there is a better way to write the code to do this....do you have any suggestions? Thanks, Kyosys