For Programmers: Free Programming Magazines  


Home > Archive > PHP Programming > January 2007 > how to store an array in cookie









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author how to store an array in cookie
Amar

2007-01-29, 7:58 am

Hi All,

In my application, I have a page, which displays a number of
rows, and each row having a check box . I can check more than one
check box on this page and I have to store all these check box values
on a single cookie . Like if I am storing some ids as the values for
the check boxes ,then I have to put all thesee ids of the checkboxes
into a single cookie , which are checked .

Please help me.

Thanks
amar

Arjen

2007-01-29, 7:58 am

Amar schreef:
> Hi All,
>
> In my application, I have a page, which displays a number of
> rows, and each row having a check box . I can check more than one
> check box on this page and I have to store all these check box values
> on a single cookie . Like if I am storing some ids as the values for
> the check boxes ,then I have to put all thesee ids of the checkboxes
> into a single cookie , which are checked .
>
> Please help me.
>
> Thanks
> amar


Why cookies ? They are unreliable. Use sessions (or a database if you
need to store them for a longer time).


--
Arjen
http://www.hondenpage.com
Tyrone Slothrop

2007-01-29, 6:59 pm

On 29 Jan 2007 03:39:37 -0800, "Amar" <ghungur.2006@gmail.com> wrote:

>Hi All,
>
> In my application, I have a page, which displays a number of
>rows, and each row having a check box . I can check more than one
>check box on this page and I have to store all these check box values
>on a single cookie . Like if I am storing some ids as the values for
>the check boxes ,then I have to put all thesee ids of the checkboxes
>into a single cookie , which are checked .
>
>Please help me.
>
>Thanks
>amar


http://us2.php.net/serialize
Colin McKinnon

2007-01-29, 6:59 pm

Arjen wrote:

> Amar schreef:
>
> Why cookies ? They are unreliable. Use sessions (or a database if you
> need to store them for a longer time).
>
>


Arjen: how do you think your server knows which session the request is
associated with.

Amar:
Cookies are (at least) as reliable as sessions - the problem is ITS THE
WRONG PLACE TO KEEP POLYMORPHIC USER DATA STRUCTURES.

If you must, try using a bitfield. But don't I didn't warn you when it blows
up in your face.

C.
Arjen

2007-01-30, 3:59 am

Colin McKinnon schreef:
> Arjen wrote:
>
>
> Arjen: how do you think your server knows which session the request is
> associated with.


RTFM :-D
A visitor accessing your web site is assigned an unique id, the
so-called session id. This is either stored in a cookie on the user side
or is propagated in the URL.

Some of the cookies (atleas in older browsers) fail. Cookies are not
reliable.

--
Arjen
http://www.hondenpage.com - Mijn site over honden
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com