Cookie Question

They have: 38 posts

Joined: Dec 2002

I am new to writing cookies. What i am looking to do is when someone comes to my web site and if they have a query string attached I would like a cookie to store that query string until they get to my contact page where it will get placed and sent to me. This is so I know where people are coming from. Is there a tutorial on how to do this?

Thanks!

druagord's picture

He has: 335 posts

Joined: May 2003

well fisrt what language are you using ?
then your language should have a function to grab the querystring put it in a cookie with a name you will remember use it as any aother cookie

IF , ELSE , WHILE isn't that what life is all about

They have: 38 posts

Joined: Dec 2002

I will be using PHP

druagord's picture

He has: 335 posts

Joined: May 2003

first use session variables it will manage the cookie for you

<?php
session_start
();
?>

this as to be in the code before any headers are sent ie.: ( or header(); or anything like that)

<?php
$_SESSION
['myquery']=$_SERVER['QUERY_STRING'];
?>

i would suggest you also check what's in $_SERVER['HTTP_REFERER'] you casn find what he type in google like this

IF , ELSE , WHILE isn't that what life is all about

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.