<?php
require_once "query_string.php";
$qs = new Query_String; //By default, our object will be populated from $_GET
//Print our current query string
print "<h2>Initial query string:</h2><p><a href='".$qs."'>".$qs."</a></p>";
//Add a few variables to our query string
$qs->page = rand(1, 12);
$qs->sort = "ascending";
$qs->filter = "yes";
//Print out a new version of our query string
print "<h2>Modified query string:</h2><p><a href='".$qs."'>".$qs."</a></p>";
//Change a few more variables in the query string
$qs->sort = "descending";
unset($qs->page);
unset($qs->timestamp);
//Print out a new version of our query string
print "<h2>Query string without page or timestamp:</h2><p><a href='".$qs."'>".$qs."</a></p>";
//Add more data to the query string
$qs->timestamp = time();
//Print out a new version of our query string
print "<h2>Modified query string with timestamp added:</h2><p><a href='".$qs."'>".$qs."</a></p>";
//Start over from scratch
$qs->set_array( array() );
$qs->boolean = false; //TRUE and FALSE are automatically converted into text by the class
//Print out a new version of our query string
print "<h2>Reset query string and added a boolean value:</h2><p><a href='".$qs."'>".$qs."</a></p>";
//The above examples use $qs->__toString() to generate the printed text.
//Alternately, you can use $qs->url() to generate the query string without the HTML-escaped ampersands (perfect for location redirects)
?>
|