note 31331 added to function.serialize

From: Date: Thu, 17 Apr 2003 16:38:46 +0000
Subject: note 31331 added to function.serialize
Groups: php.notes 
Request: Send a blank email to php-notes+get-46743@lists.php.net to get a copy of this message
Hi! If you wanna save all the POST data and reload it again in another time... you can use this: (Thanks for my_stripslashes() function ;-) // saving POST if ($REQUEST_METHOD=="POST") { $fp = fopen("postData.txt","w"); $data = addslashes(serialize($_POST)); fwrite($fp, $data); fclose($fp); } // reloading POST and passing to variables if (file_exists("postData.txt")) { $data = file("postData.txt"); $data = my_stripslashes($data[0]); // catches it in some message above $postData = unserialize($data); extract($postData, EXTR_OVERWRITE); } Now you have all variables from old POST in your actual script. Well useful when you have a great form very used and of course, DEPENDING of your tool. -- http://www.php.net/manual/en/function.serialize.php http://master.php.net/manage/user-notes.php?action=edit+31331 http://master.php.net/manage/user-notes.php?action=delete+31331 http://master.php.net/manage/user-notes.php?action=reject+31331

« previous php.notes (#46743) next »