[PHP] setcookie with array (was serialize)

2002-03-28 Thread Rodrigo Peres

Hi list,

Regarding my last post about serialize, I've tried many things but couldn't
make it function.

I'm trying to store the data from a form in order to allow my user to stop
the process of filling the form and retrieve later what was inserted before.

Among many other thing I tried this little script only to test but didn't
work. why??

if(isset($submit)) {
$x = addslashes($HTTP_POST_VARS);
$y = serialize($x);
setcookie(posted,$y)
}
if($posted) {
$w = unserialize($posted);
$j = stripslashes($w);
echo(count($j));
}

The script aways returns 1, but I've submited 10 values.

Thank's in advance

Rodrigo


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] setcookie with array (was serialize)

2002-03-28 Thread Jason Wong

On Thursday 28 March 2002 23:25, Rodrigo Peres wrote:
 Hi list,

 Regarding my last post about serialize, I've tried many things but couldn't
 make it function.

 I'm trying to store the data from a form in order to allow my user to stop
 the process of filling the form and retrieve later what was inserted
 before.

 Among many other thing I tried this little script only to test but didn't
 work. why??

 if(isset($submit)) {
 $x = addslashes($HTTP_POST_VARS);

addslashes works on string, $HTTP_POST_VARS is an array?

-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk

/*
Take care of the luxuries and the necessities will take care of themselves.
-- Lazarus Long
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] setcookie with array (was serialize)

2002-03-28 Thread Miguel Cruz

On Thu, 28 Mar 2002, Rodrigo Peres wrote:
 if(isset($submit)) {
 $x = addslashes($HTTP_POST_VARS);
 $y = serialize($x);
 setcookie(posted,$y)
 }

1) You probably should call serialize on the array to turn it into a
string before trying any string transformations like addslashes. If you 
don't understand what is going on, help yourself out by printing out the 
values every step of the way.

2) You don't need to use addslashes anyway because it has nothing to do
with cookies; they are not quoted.

miguel


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php