TheFilmGod Posted March 19, 2007 Share Posted March 19, 2007 I want to transfer a variable to the next page. Here is the code: First Page: $page="1"; <a href="fav.php?page=$page">I like it!</a> Second Page, (retrieves the variable) $page = $_GET['$page']; Link to comment https://forums.phpfreaks.com/topic/43391-solved-get-variables/ Share on other sites More sharing options...
bwochinski Posted March 19, 2007 Share Posted March 19, 2007 close... but you have to go back into PHP when inserting your variable into the HTML <?php $page="1"; ?> <a href="fav.php?page=<?=$page;?>">I like it!</a> (the syntax highlighter here doesn't like the <?= tag) Link to comment https://forums.phpfreaks.com/topic/43391-solved-get-variables/#findComment-210727 Share on other sites More sharing options...
per1os Posted March 19, 2007 Share Posted March 19, 2007 I was informed by a higher power that the <?= is being depreciated I would do this: <?php $page="1"; ?> <a href="fav.php?page=<?php print $page; ?>">I like it!</a> Link to comment https://forums.phpfreaks.com/topic/43391-solved-get-variables/#findComment-210729 Share on other sites More sharing options...
TheFilmGod Posted March 19, 2007 Author Share Posted March 19, 2007 It worked! I'm going to stick with "<?php" as this is the safe way to go! Thanks for the help! Link to comment https://forums.phpfreaks.com/topic/43391-solved-get-variables/#findComment-210736 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.