setting cookies with $HTTP_POST_VARS[fname]
Posted: Tue Aug 05, 2003 1:59 pm
I'm trying to set some cookies for my users and I'm having a tough time getting it to work. I know the setcookie() method needs to be called before anything else on the page so I've pretty much designed it that way. Here's what doesn't work:
<?
require "/utilities/SiteUtilities.class";
$page = new SiteUtilities;
session_start();
$expiry = 60*60*24*100;
session_set_cookie_params ($expiry,"",".domain.com",0);
$isFnameSet = setcookie ("fname",$HTTP_POST_VARS[fname],$expiry,"/",".domain.com",0);
?>
Here's what does work:
<?
require "/utilities/SiteUtilities.class";
$page = new SiteUtilities;
session_start();
$expiry = 60*60*24*100;
session_set_cookie_params ($expiry,"",".domain.com",0);
$isFnameSet = setcookie ("fname","john",$expiry,"/",".domain.com",0);
?>
So I believe by process of elimination that $HTTP_POST_VARS[fname] is causing the problem. I have to be able to use this because the info is coming from the previous page. Anyone got a solution?
Thanks!!
<?
require "/utilities/SiteUtilities.class";
$page = new SiteUtilities;
session_start();
$expiry = 60*60*24*100;
session_set_cookie_params ($expiry,"",".domain.com",0);
$isFnameSet = setcookie ("fname",$HTTP_POST_VARS[fname],$expiry,"/",".domain.com",0);
?>
Here's what does work:
<?
require "/utilities/SiteUtilities.class";
$page = new SiteUtilities;
session_start();
$expiry = 60*60*24*100;
session_set_cookie_params ($expiry,"",".domain.com",0);
$isFnameSet = setcookie ("fname","john",$expiry,"/",".domain.com",0);
?>
So I believe by process of elimination that $HTTP_POST_VARS[fname] is causing the problem. I have to be able to use this because the info is coming from the previous page. Anyone got a solution?
Thanks!!