More GETting

Normally, the hyperlink that includes a query string is on the page itself. Try the following code to do just that.

<title>PHP Test</title>
if (isset($_GET['name']))
   $thename= $_GET['name'];
   echo "<h1>Hello ".$thename."</h1>";
   echo "<h1>Click A Link</h1>\n
   <ul> \n
   <li><a href='get.php?name=Josh'>Joshington</a></li> \n
   <li><a href='get.php?name=Sam'>Samington</a></li> \n
   <li><a href='get.php?name=James'>Jamesington</a></li \n>
   <li><a href='get.php?name=Jacob'>Jacobington</a></li> \n
   <li><a href='get.php?name=Lucy'>Lucyington</a></li> \n
   <li><a href='get.php?name=Matty'>Geographington</a></li> \n
   <li><a href='get.php?name=Tamsin'>Tamsington</a></li> \n
   <li><a href='get.php?name=Matt'>Mattington</a></li> \n
   <li><a href='get.php?name=Aidan'>Aidanington</a></li> \n
   </ul> \n";

Obviously, you should amend this when you've seen how it works in principle.

In this page, the isset() function is used to see if a given variable has a value stored. It is a highly useful statement that exists in a few other interpreted languages. Notice the use of brackets for the IF condition. If the query string is not found, a suitable set of hyperlinks is included.