Cookie loss

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
fitchic77
Forum Commoner
Posts: 51
Joined: Thu Jul 20, 2006 11:57 pm

Cookie loss

Post by fitchic77 »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


I'm already have these cookies set in a form and see their values:

Code: Select all

$jewel_condition = $_COOKIE['sellNow']['jewel_condition']; 
$metal = $_COOKIE['sellNow']['metal']; 
$price = $_COOKIE['sellNow']['price']; 
$description = $_COOKIE['sellNow']['description']; 
$active = $_COOKIE['sellNow']['active']; 
////////////////////////////////////////////////
$package_type = $_COOKIE['sellNow']['package_type']; 
$package_id = $_COOKIE['sellNow']['package_id']; 
$county = $_COOKIE['sellNow']['county']; 
$state = $_COOKIE['sellNow']['state']; 
$email = $_COOKIE['sellNow']['email']; 
$phone1 = $_COOKIE['sellNow']['phone1']; 
$phone2 = $_COOKIE['sellNow']['phone2']; 
////////////////////////////////////////////////
$jewelry_type = $_COOKIE['sellNow']['jewelry_type']; 
$size = $_COOKIE['sellNow']['size'];


Then I have to do some validation after the form processes (process.php)...if it fails, I have tested either way:

Code: Select all

header("Location: userReg.php?error=UE");
OR

Code: Select all

javascript: window.location ="userReg.php?error=UE";

I have several cookies like this set...I ONLY loose values in these and not any of the others. I'm stumped!! I can see them in the processing form(process.php), but as soon as I go back these are cleared out....and only these :?:

Code: Select all

$package_type = $_COOKIE['sellNow']['package_type']; 
$package_id = $_COOKIE['sellNow']['package_id']; 
$county = $_COOKIE['sellNow']['county']; 
$state = $_COOKIE['sellNow']['state']; 
$email = $_COOKIE['sellNow']['email']; 
$phone1 = $_COOKIE['sellNow']['phone1']; 
$phone2 = $_COOKIE['sellNow']['phone2'];

Any ideas would be GREATLY appreciated..


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Last edited by fitchic77 on Sat Oct 16, 2010 11:39 am, edited 1 time in total.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I would imagine you're going beyond the size limits of the cookie that the browser allows. The maximum size is usually around 4K, I would consider an alternative storage medium, such as in a session.
fitchic77
Forum Commoner
Posts: 51
Joined: Thu Jul 20, 2006 11:57 pm

Post by fitchic77 »

I have also tried it with a session variable and it gets lost after I do the PHP header location or a javascript window.location.

The previous cookie example can't be a memory issue or it would fail to store all the other items.
Last edited by fitchic77 on Sat Oct 16, 2010 11:38 am, edited 1 time in total.
fitchic77
Forum Commoner
Posts: 51
Joined: Thu Jul 20, 2006 11:57 pm

SOLVED

Post by fitchic77 »

I was doing a redirect back to a page that had <HTML><head>etc...for some reason this whiped out the cookie and session information.

I just hardcoded the header.inc instead and all works great.
Post Reply