Well I figured my code is horribly obvious so instead of explaining what it does, I'll just post it.
Here's my page 1 php:
include "class.php";
$dog1 = new dog("Barko");
$dog1->age = 8;
print "My name is ";
print $dog1->name;
print " and I'm ";
print $dog1->age;
print " years old";
print " Watch me multiply 5 and 7: " . $dog1->multiply(5,7);
print " " . $dog1->bark();
$_SESSION['dogOne'] = $dog1;
and I want that dog to exist on the next page so I put
include "class.php";
$dog1 = new dog("WhoCares");
if (isset($_SESSION['dog1']))
{
$dog1 = $_SESSION['dog1'];
print "My name is still ";
print $dog1->name;
print " and I'm still ";
print $dog1->age;
print " years old";
}
else
{
print "No dog was found";
}
yeah I know, I'm a VB programmer and that's a very VB OOP way of doing it but I thought it would work. I gotta help someone with a php project that does something pretty much identical to this. And here's something that'll really piss you off. I actually have a PC programming AND a Web Programming degree but I barely know a thing about php. How? Cuz at my college they thought 9 weeks of php would cover it and the rest was html, javascript, XML, and AJAX. Yeah, I know, that's as stupid as it gets. I wasn't too happy either. So yeah, I don't know a ton about php so I'm sure it's something stupid causing this to not work. Basically the problem is every time I get to page 2 even from a link on page 1, it never follows the true branch of the if statement and always prints that no dog was found. Can't you just save an object to a session and make a new one and page 2 then replace it with the saved session one? VB lets you do that.
So what's up with that and is there a better way of preserving objects between pages that I should be using instead?
P.S. don't ask why my dog Barko can multiply, he just can