Entry
How do I save form data to a file, as with perl cgi.pm query->save(FILE) ?
Mar 15th, 2008 18:01
ha mo, Brian Duhan, blair leavell, http://www.php.net/serialize http://www.php.net/unserialize http://www.php.net/fopen http://www.php.net/fwrite
I would use the serialize() and unserialize() functions. First, get a
serialized string to write to your file:
>>> $string = serialize ($_REQUEST);
$_REQUEST has all of $_POST, $_GET, and $_COOKIE
Next, take $string and write it to a file (read the manual).
To restore the information, read the data from the file into a string
and then unserialize:
>>> $restored_REQUEST = unserialize ($string);
I have used this to successfully store an associative array in a file
and call it back up from another program.
http://www.tantofa.com
http://www.fantofa.com
http://www.mantofa.com
http://www.tanpola.com
http://www.tampola.com
http://www.mozmar.com
http://www.yamot.com
http://www.templatestemp.com