swampone Posted June 30, 2010 Share Posted June 30, 2010 Im having trouble passing varibles to other pages. I can see that the variable there in the url. localhost/page.php?page=1. The I try to echo the value on page.php to see that it is working, and all I get is a blank page. What am I missing here? <?php echo $page; Link to comment https://forums.phpfreaks.com/topic/206243-passing-variables-through-links/ Share on other sites More sharing options...
joel24 Posted June 30, 2010 Share Posted June 30, 2010 if the variable is being sent in the URL, you need to use $_GET['variable'] to retrieve it. i.e. localhost/page.php?page=1 $page = $_GET['page']; echo $page; you will want to use isset to ensure no notices are returned, i.e. localhost/page.php?page=1 if (isset($_GET['page']) { $page = $_GET['page']; echo $page; } Link to comment https://forums.phpfreaks.com/topic/206243-passing-variables-through-links/#findComment-1078994 Share on other sites More sharing options...
swampone Posted June 30, 2010 Author Share Posted June 30, 2010 That was it. Thanks! Link to comment https://forums.phpfreaks.com/topic/206243-passing-variables-through-links/#findComment-1078995 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.