Re: Problems reading a DOMDocument out of a session

From: Date: Mon, 25 Apr 2005 14:44:53 +0000
Subject: Re: Problems reading a DOMDocument out of a session
Groups: php.general 
Request: Send a blank email to php-general+get-213808@lists.php.net to get a copy of this message
Because I'm not sure if attachments are included in this mailinglist, I copied the source of my sample script: ----- start file ------ <? session_start(); if (!$_POST) { // Make new DOMDocument $dom = new DOMDocument('1.0', 'utf-8'); $dom->loadXML('<root><node>The almighty DOM</node></root>'); // Write DOMDocument to session $_SESSION['dom'] = $dom; // Trying a variable too $_SESSION['var'] = 'foo'; //check if we could fetch the DOM out of the session before the form send. print $_SESSION['dom']->saveXML(); } else { // Read DOMDocument out of session after send, this doesn't work print $_SESSION['dom']->saveXML(); // Read the variable out to prove the session is ok print $_SESSION['var']; } ?> <!DOCTYPE html PUBLIC " -//W3C//DTD XHTML 1.0 Strict//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>PHP sample file</title> </head> <body> <form name="login" action="index.php" method="post"> <input type="hidden" name="aaa"><input type="submit" value="Submit"> </form> </body> </html> ----- end of file ------

« previous php.general (#213808) next »