jeboy Posted May 7, 2008 Share Posted May 7, 2008 How can I use an object to another page? This is my code but didn't work: 1st Page $peter = new employee; $peter->setPosition('programmer'); $safePeter = urlencode(serialize($peter)); <a href="url2.php?employee=<?php echo $safePeter; ?>">Next Page</a> 2nd Page $employee = urldecode(unserialize($_GET['employee'])); var_dump($employee); Link to comment https://forums.phpfreaks.com/topic/104497-how-to-use-an-object-to-another-page/ Share on other sites More sharing options...
benphp Posted May 7, 2008 Share Posted May 7, 2008 Yer better off using cookies/sessions. Link to comment https://forums.phpfreaks.com/topic/104497-how-to-use-an-object-to-another-page/#findComment-534950 Share on other sites More sharing options...
jeboy Posted May 7, 2008 Author Share Posted May 7, 2008 Is the class definition needed in the second page? Link to comment https://forums.phpfreaks.com/topic/104497-how-to-use-an-object-to-another-page/#findComment-534955 Share on other sites More sharing options...
trq Posted May 7, 2008 Share Posted May 7, 2008 Yes. Link to comment https://forums.phpfreaks.com/topic/104497-how-to-use-an-object-to-another-page/#findComment-534958 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.