Re: Problems reading a DOMDocument out of a session

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 ------

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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux