By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,967 Members | 1,687 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,967 IT Pros & Developers. It's quick & easy.

Set a cookie and then redirect

P: n/a
Hi,

I'm trying to:

a) Capture a parameter form the query string
b) Save it as a cookie
c) Redirect to somewhere else

Step (a) is where I'm getting into trouble. This is my code:

<?php

$exe_url = 'http://www.google.com';

$value = _GET['affId'];
if (strlen($value)) {
setcookie( 'affId', $value, time() + 86400, "/");
}
header( 'Location:' . $exe_url ) ;

exit;
?>

If $value es hard coded, everything works fine, but if I try to pick
it from the query string with _GET, nothing works and it displays a
blank page.

What am I doing wrong???

Thanks!
Sep 4 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
ag****@gmail.com wrote:
Hi,

I'm trying to:

a) Capture a parameter form the query string
b) Save it as a cookie
c) Redirect to somewhere else

Step (a) is where I'm getting into trouble. This is my code:

<?php

$exe_url = 'http://www.google.com';

$value = _GET['affId'];
$_GET , you dropped the "$".
>

if (strlen($value)) {
setcookie( 'affId', $value, time() + 86400, "/");
}
header( 'Location:' . $exe_url ) ;

exit;
?>

If $value es hard coded, everything works fine, but if I try to pick
it from the query string with _GET, nothing works and it displays a
blank page.

What am I doing wrong???

Thanks!
Sep 4 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.