Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // In response to a Yahoo Answer's Question
- if(!isset($_GET['pg'])){
- $_GET['pg'] = 50;
- }
- function urlVarsMod($name, $value){
- $g = $_GET;
- $g[$name] = $value;
- return http_build_query($g);
- }
- // Basic Example to show you how to do so
- echo '<a href="?' . urlVarsMod('pg',($_GET['pg'] - 1)) . '">Prev</a> [' . $_GET['pg'] . '] <a href="?' . urlVarsMod('pg', ($_GET['pg'] + 1) ) . '">Next</a>';
- echo '<h3>Current Page: ' . $_GET['pg'] . '</h3>';
- echo '<p>Go Ahead, place some variables in the URL, test away</p>';
- echo '<table border="1" cellpadding="5"><tr><th>Name</th><th>Value</th></tr>';
- foreach($_GET as $n=>$v){
- echo '<tr><td>' . $n . '</td><td>' . $v . '</td></tr>';
- }
- echo '</table>';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement