rendered paste bodypage1.php
===========================================================================
<?php
require_once 'testclass.php';
$tc = new TestClass;
?>
<html>
<body>
<?php
$tc->display();
$str = htmlspecialchars( serialize( $tc ) );
echo "\$str = $str<br>\n";
?>
<form method = "post" action = "page2.php">
<input type = "hidden" name = "str" value = "<?php echo $str; ?>">
<input type = "submit" value = "next page">
</form>
</body>
</html>
===========================================================================
page2.php
===========================================================================
<?php
require_once 'testclass.php';
$str = stripslashes( htmlspecialchars_decode( $_POST["str"] ) );
$tc = unserialize( $str );
?>
<html>
<body>
<?php
$tc->display();
echo "\$str = $str<br>\n";
?>
</body>
</html>
===========================================================================
testclass.php
===========================================================================
<?php
class TestClass {
var $i = 5;
var $j = 'This is a "test" string';
function display() {
echo "i=" . $this->i . "<br>\n";
echo "j=" . $this->j . "<br>\n";
}
}
?>
===========================================================================