Forum Moderators: coopster
The stored cookie value (ie: xyz) can then be placed anywhere within the site via a php include... similar to the 'QUERY_STRING' method (see below) but obviously calling the cookie (NOT $_SERVER).
example:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="item_name" value="<?php echo $_SERVER['QUERY_STRING'];?></">
<input type="hidden" name="item_number" value="1001">
<input border="0" name="submit" alt="Make payments with PayPal">
</form>
or
<a href=http://anysite.com/query=<?php echo $_SERVER['QUERY_STRING'];?>/index.html>special query derived link</a>
Cheers, Wayne.
[edited by: jatar_k at 7:05 pm (utc) on Nov. 1, 2004]
[edit reason] removed url [/edit]
For an instance, when someone visits the url
[domain.com...]
you can access this value (xyz) using $_GET['refer']
then you may store this in a cookie like this..
setcookie("refer", $_GET['refer'], time()+60*60*24*30);
now that u have the value stored, you can access it in your pages in the following way..
if(isset($HTTP_COOKIE_VARS["refer"])){
echo $_COOKIE["refer"];
}
Hope it helps..
The cookie is stored fine but when i view the page again without any query (?), the cookie is removed (obviously reset by having no query or (?) - is there anyway that any valid query willbe stored and not be overwritten by an empty query? ie: retrieves last "valid" query, so if someone does visit the link and tries to get around the query by removing the (?), it will retrieve the valid cookie (wont appear as empty.)
Cheers, rebeat