PDA

View Full Version : Passing control to another url?


gorilla1
11-29-2002, 04:51 PM
I am looking to count the numnber of times a link on my page is clicked. I cant put the counter on the page that the link calls, because that page is outside my site. I guess what I need to do is execute some code when the link is hit and then go link to the other url - but is it possible to load a url and pass control in that way?

G

Ökii
11-29-2002, 05:00 PM
normally you would just pass the new page reference to a script of your own.

<a href="myscript.php?newpage=http://blat.com">

myscript.php

$newpage = $HTTP_GET_VARS['newpage'];

[[[ db stuff --- > "UPDATE field SET count=count+1 WHERE pageref='$newpage'" ]]]

header("location: $newpage");

[edit note] the header () call would effect a redirect to the new page in question without the script having to output anything [/note]

gorilla1
11-29-2002, 05:17 PM
Okii, Ok thanks... Excellent.