note 676 modified in function.serialize by ronabop

From: Date: Tue, 16 Apr 2002 04:33:27 +0000
Subject: note 676 modified in function.serialize by ronabop
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-29414@lists.php.net to get a copy of this message
Based on my experience: If you are storing serialized data in a database, you need to serialize() the data, *then* addslashes(), then stick it in the DB. When you pull it out, stripslashes() (if you don't automatically do it), then unserialize(). If you are passing serialized data between pages in hidden form fields, you need to serialize() the data, then *urlencode()* it, then put it in the hidden field. When you get to the next page, urldecode() it, then unserialize(). If you are passing serialized data in a query string, you don't need to urldecode() it on the following page. Just unserialize(). --was-- <B>Oops!</B><BR> <BR> If you are passing serialized data in a <i>query string</i>, you <B>don't</B> need to urldecode() it on the following page. Just unserialize().<BR> <BR> Hidden <i>form fields</i>, however, need to be urldecode()-ed then unserialize()-ed as stated above.<BR> http://www.php.net/manual/en/function.serialize.php

« previous php.notes (#29414) next »