soccerstar22003
-
Posts
4 -
Joined
-
Last visited
Never
Posts posted by soccerstar22003
-
-
i redesigned the code to use the index.php?home format and this is what i came up with
[code]<?
if (!isset($_GET)) {
include ("home.html");
} elseif (isset($_GET['home'])) { <--------Line 37
include ("home.html");
} elseif (isset($_GET['contracts'])) {
include ("contracts.html");
} elseif (isset($_GET['reminders'])) {
include ("reminders.html");
} elseif (isset($_GET['accessories'])) {
include ("accessories.html");
} elseif (isset($_GET['contactus'])) {
include ("contactus.html");
} else {
include ("home.html");
}
?>
[/code]
it looks good to me but now i got a new issue, the error is almost the same: "Parse error: syntax error, unexpected '{' in C:\Inetpub\PMPOOLS\index.php on line 37"
its as if it is not accepting the elseif statement isn't there so it is not expecting the condition that follows it. any reasons why it would do that? -
thanks for the help, the code works now. i also have one other question. right now i am passing variable in the URL using /index.php?page=home but i have seen people use /index.php?home if i use the second script, how do i retrieve the variable home.
-
[code]
<?
if (!isset($_GET['page'])) {
include ("home.html");
} else { <-------- Line 36
if ($_GET['page'] != (home|contracts|reminders|accessories|contactus) {
include ("home.html");
} else {
$page = $_GET['page'];
include ("/content/".$page.".html");
}
}
?>
[/code]
to me that looks fine, but when i test it, it comes up and says "Parse error: syntax error, unexpected '}' in C:\website\index.php on line 36" [img src=\"style_emoticons/[#EMO_DIR#]/huh.gif\" style=\"vertical-align:middle\" emoid=\":huh:\" border=\"0\" alt=\"huh.gif\" /] i marked line 36 in the code
any help appreciated
problem with a simple if statement
in PHP Coding Help
Posted