Hello,
I am trying to get a get parameter from a url, and then generate html from it. I cannot get it to work, I have tried echo'ing the parameter but it shows nothing. But then my code gets into a switch statement which is from an isset about the parameter.
<?php
global $path1;
global $path2;
$path1="";
$path2="";
if (isset($_GET['path1']))
{
$path1=$_GET['path1'];
}
if (isset($_GET['path2']))
{
$path2=$_GET['path2'];
}
$output="<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"><html xmlns=\"http://www.w3.org/1999/xhtml\"><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /><title>Untitled</title><link rel=\"stylesheet\" href=\"http://localhost/style.css\" /></head><body><div class=\"container\"><div class=\"header\">image will go here..</div>
<img src=\"http://localhost/images/spacer.png\" height=\"3\" width=\"960\" alt=\"spacer\" />
<div class=\"main\">";
print($output);
echo "get";
echo $_GET['path1'];
echo "uri";
echo $_SERVER['REQUEST_URI'];
if (isset($path1))
{
echo "IN";
switch ($path1)
{
case "join":
echo "123";
include("join.php");
break;
case "forum":
include("forum-index.php");
break;
default:
echo "456";
include("404.php");
}
}
else
{
include("start_page.php");
}
$output="</div><div class=\"footer\"><center>Copyright ". date('Y') ."</center></div></div></body></html>";
print($output);
?>
Displayed output when my URL is localhost/join:
image will go here..
get uri/joinIN456