I need help with a switch command. I keeping getting a parse error that points at the end end of the script. That's why it says possible problem with the switch.
here the content.php
<?php
function storeCategory(){
$category = array(
0 => array("id" => 0, "name" => "Home", "page"=> "main.php"),
1 => array("id" => 1, "name" => "Birthday", "page"=> "bday.php"),
2 => array("id" => 2, "name" => "Anniversary", "page"=> "anniv.php"),
3 => array("id" => 3, "name" => "Wedding", "page"=> "wedding.php"),
4 => array("id" => 4, "name" => "Funeral", "page"=> "funeral.php"),
5 => array("id" => 5, "name" => "Love & Romance", "page"=> "l&r.php"),
6 => array("id" => 6, "name" => "All", "page"=> "all.php"),
7 => array("id" => 7, "name" => "Balloons", "page"=> "ball.php"),
8 => array("id" => 8, "name" => "Plants", "page"=> "plant.php"),
9 => array("id" => 9, "name" => "Contact", "page"=> "contact.php"),
);
return $category;
}
function getContent($id){
$content = storeCategory();
for($x=0; $x<sizeof($content); $x++){
if (rtrim(ltrim($content[$x]["id"])) == $id){
$print_content = rtrim(ltrim($content[$x]["page"]));
}
return $print_content;
}
switch ($x){
case Home:
include ('main.php');
break;
case Birthday:
include ('bday.php');
break;
case Anniversary:
include ('anniv.php');
break;
case Wedding:
include ('wedding.php');
break;
case Funeral:
include ('funeral.php');
break;
case Love & Romance:
include ('l&r.php');
break;
case All:
include ('all.php');
break;
case Balloons:
include ('ball.php');
break;
case Plants:
include ('plant.php');
break;
case Contact:
include ('contact.php');
break;
}
?>
and here's my menu.php
<?php
echo "<a href=\"".$PHP_SELF."?show=($id)\">Home</a><br />";
echo "<a href=\"".$PHP_SELF."?show=($id)\">Birthday</a><br />";
echo "<a href=\"".$PHP_SELF."?show=($id)\">Anniversary</a><br />";
echo "<a href=\"".$PHP_SELF."?show=($id)\">Wedding</a><br />";
echo "<a href=\"".$PHP_SELF."?show=($id)\">Funeral</a><br />";
echo "<a href=\"".$PHP_SELF."?show=($id)\">Love & Romance</a><br />";
echo "<a href=\"".$PHP_SELF."?show=($id)\">All Occassion</a><br />";
echo "<a href=\"".$PHP_SELF."?show=($id)\">Balloons</a><br />";
echo "<a href=\"".$PHP_SELF."?show=($id)\">Plants</a><br />";
echo "<a href=\"".$PHP_SELF."?show=($id)\">Contact Us</a><br />";
?>
I been looking over the content.php several times the past couple of days and just can't locate the problem.
Is there anything in the content.php script that I could of left out and on the side not I'm a newb to php and doing my best to build with php.