I need help with PHP!!!

Started by Lord Kokkei October 5th, 2005 2:00 PM
  • 925 views
  • 1 replies
Age 32
Canada
Seen November 3rd, 2013
Posted May 10th, 2009
311 posts
17.7 Years
ok so i found this code in this thread:http://www.pokecommunity.com/showthread.php?t=29287
then i insertrd it in the following way:

echo "            <tr>\n";

echo "              <td width=\"100%\" bgcolor=\"#808080\">\n";
echo "<?php\n";
echo "
\n";
echo "
$news = \"news.php\";\n";
echo 
"$error = \"404.htm\";\n";
echo 
"$ext = \".htm\";\n";
echo 
"\n";
echo 
"if(!isset($_GET['id'])){\n";
echo 
"include $news;\n";
echo 
"}\n";
echo 
"elseif($_GET['id'] == \"main\") {\n";
echo 
"include $news;\n";
echo 
"}\n";
echo 
"elseif(isset($_GET['id']) && file_exists($_GET['id'].$ext)){\n";
echo 
"include $_GET['id'].$ext;\n";
echo 
"}\n";
echo 
"else{\n";
echo 
"include $error;\n";
echo 
"}\n";
echo 
"\n";
echo 
"?>\n";
echo 
"              </td>\n";
echo 
"            </tr>\n";
but when i went to my site this shows up:
Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /usr/export/www/hosting/sdz4/index.php on line 195
so im wondering here if i insertrd the code wrong or something?
Age 35
Alberta, Canada
Seen October 29th, 2006
Posted October 20th, 2005
231 posts
18 Years
Okay, charlizard - forgive me if I sound harsh but:

YOU DO NOT PUT PHP INTO echo() REQUESTS, UNLESS YOU KNOW WHAT YOU ARE DOING!!!!


First off, is the <?php and the ?> before and after the code respectively?
Second, here is how you should paste it in, if the second is correct:


echo "            <tr>\n"
echo 
"             <td width=\"100%\" bgcolor=\"#808080\">\n"
$news "news.php";
$error "404.htm";
$ext ".htm";
if(!isset(
$_GET['id'])){
     include 
$news;
} elseif(
$_GET['id'] == "main") {
     include 
$news;
} elseif(isset(
$_GET['id']) && file_exists($_GET['id'].$ext)){ 
   include 
$_GET['id'].$ext;
} else {
     include 
$error;
}
echo 
"              </td>\n"
echo 
"            </tr>\n"
Third, are all your files you want to include, in .htm format? If they aren't, change the $ext variable.

That's enough help for now, IMHO.
Kyle Korleski
My personal home page

My blog

I have decided that some of the staffers here are corrupt, some of the members ain't much better (btw, I know whom is giving me all the bad rep points) and this isn't the place I need to be. I will only lurk around until those few times my assistance will be needed. Good day. You can find me at Resource Zone as well as my other fora if you need to talk to me immediately.