immanuelx2 Posted June 17, 2007 Share Posted June 17, 2007 echo '<a href="?'; if ($_GET['sort']) echo 'sort='.$sort.'&'; if ($_GET['flow']) echo 'flow='.$flow.'&'; if ($_GET['game_id']) echo 'game_id='.$_GET['game_id'].'&'; if ($_GET['server_id']) echo 'server_id='.$_GET['server_id'].'&'; echo 'page='.$pagenext.'">NEXT»</a>'; Is there an easier way to construct a link while keeping all the set $_GET values? Link to comment https://forums.phpfreaks.com/topic/55976-rollover-_gets-easier-way-to-do-it/ Share on other sites More sharing options...
pocobueno1388 Posted June 17, 2007 Share Posted June 17, 2007 Maybe store the URL in a variable? <?php $link = ""; if ($_GET['sort']) $link .= 'sort='.$sort.'&'; if ($_GET['flow']) $link .= 'flow='.$flow.'&'; if ($_GET['game_id']) $link .= 'game_id='.$_GET['game_id'].'&'; if ($_GET['server_id']) $link .= 'server_id='.$_GET['server_id'].'&'; echo '<a href="?'.$link.'?page='.$pagenext.'">NEXT»</a>'; ?> Other than that...it looks like a pretty solid method for putting together the link. Here is a different approach at it.... <?php $link = ""; foreach ($_GET as $key => $val){ $link .= '&'.$key.'='.$val; } $link .= '&page='.$pagenext; echo '<a href="'.$link.'">Test</a>'; ?> Link to comment https://forums.phpfreaks.com/topic/55976-rollover-_gets-easier-way-to-do-it/#findComment-276475 Share on other sites More sharing options...
Jenk Posted June 17, 2007 Share Posted June 17, 2007 $_SERVER['REQUEST_URI'] or $_SERVER['QUERY_STRING'] Link to comment https://forums.phpfreaks.com/topic/55976-rollover-_gets-easier-way-to-do-it/#findComment-276478 Share on other sites More sharing options...
pocobueno1388 Posted June 17, 2007 Share Posted June 17, 2007 Oh wow....I looked way to deep into that question. -slaps forehead- That was stupd, hah. Link to comment https://forums.phpfreaks.com/topic/55976-rollover-_gets-easier-way-to-do-it/#findComment-276483 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.