Hello there.

I was wondering if anyone here could help me out of this problem :)?

So how do you retrieve a cookie?

I have try this :

-----------------

(Cookie value = Computer and name user )

This is my what is inside my php

$myhyperlink=www.google.com/

$linktosite=$myhyperlink 'search='.$_COOKIE["user"];


header('location:'.$linktosite);

------------------------

So is $_COOKIE["user"] right to retrive a cookie?


So when i test it, my link will only open like this :

www.google.com/search=

and no cookie..

What it should be :

www.google.com/search=computer.

remmeber this is an example.


Anyway i would really appericate if someone could help me out ;)

Have you used the cookie viewer of your browser to check the cookie is being created?

Yes i have seen the cookie is created.


setcookie("user", "computer", time()+86400); did i use on my home page

this will result in the cookie value being set as computer.

setcookie("user", "computer", time()+86400);

then have this in another page that you link to, eg
have a link to redirect.php on your other pages, the save the following code as redirect.php:

<?
$cookie = $_COOKIE['user'];
$linktosite = "www.google.com?q=$cookie";
header("location: $linktosite"); 
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.