I've read up on passing classes in this newsgroup but I don't really want to register it in a session. I was wondering if there was a way to pass it via an object. I tried last night with the following two pages (without success).
Is registering an object in a session really the only way to do it?
Thanks,
KABOOM!
---------- FIRSTCLASS.PHP --------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<head>
<title>Untitled</title>
</head>
<body>
Messing around with classes:<BR>
<?PHP
class teams
{
// Properties
var $firstbase;
var $secondbase;
// Methods
function setFirstBase($name)
{ $this->firstbase = $name; }
function setSecondBase($name)
{ $this->secondbase = $name; }
function getFirstBase()
{ return $this->firstbase; }
function getSecondBase()
{ return $this->secondbase; }
}
$yankees = new teams();
$mariners = new teams();
$yankees->setFirstBase("Giambi");
$yankees->setSecondBase("Soriano");
$mariners->setFirstBase("Olerud");
$mariners->setSecondBase("Boone");
print "<table border=1>
<tr>
<td>Dude</td>
</tr>
</table><BR>";
print "<a href=\"ObjectCheck.php?teamobj=$yankees\">New York Yankees</a><BR>
<a href=\"ObjectCheck.php?teamobj=$mariners\">Seattle Mariners</a>";
?>
</body>
----------- OBJECTCHECK.PHP --------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<head>
<title>Untitled</title>
</head>
<body>
<?PHP
$1b = $teamobj->getFirstBase();
$2b = $teamobj->getSecondBase();
print "1st Base: $1b <BR>";
print "2nd Base: $2b<BR><BR>";
?>
</body>