You are here: Re: Problems reading a DOMDocument out of a session « PHP « IT news, forums, messages
Re: Problems reading a DOMDocument out of a session

Posted by Cas on 10/06/93 11:14

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация