Jump to content

[SOLVED] ummm, a eror and for my life I cant find it


sean14592

Recommended Posts

HI, Simple error I keep getting but I cant see anything wrong, Please, Please help me.

 

Error:

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/WEBSITE/public_html/new/index.php on line 23

 

Code (Lines 19-37):

<?php // start the PHP
if (isset($_GET['page'])){ // if the variable 'page' is set in the URL do this:
	if ($_GET['page'] == 'news'){ // if the variable 'page' is equal to 'news' (  /index.php?page=news ) then 
	// echo out all the information regarding that page
	echo ("<div id=\"main\"><div id=\"column\">	<div id=\"featuredproperty\"></div></div><div id=\"content\"></div></div>"); 
	} else if ($_GET['page'] == 'something'){ // if the variable 'page' is equal to 'something' (  /index.php?page=something ) then 
	// echo out all the information regarding that page
	echo ("<div id=\"main\"><div id=\"column\">	<div id=\"featuredproperty\"></div></div><div id=\"content\"></div></div>"); 
	} else if ($_GET['page'] == 'properties'){ // if the variable 'page' is equal to 'properties' (  /index.php?page=properties ) then 
	// echo out all the information regarding that page
	echo ("<div id=\"main\"><div id=\"column\">	<div id=\"featuredproperty\"></div></div><div id=\"content\"></div></div>"); 
	}

} else {
header( 'Location: '$_PHP['self']'?page=news' ) ;
// or something to this extent, I dont think this works out of the HTML <head> tags.
}
// end the PHP
?>

 

Cheers

Sean

Link to comment
Share on other sites

yep here it is....

 

<?php // start the PHP
if (isset($_GET['page'])){ // if the variable 'page' is set in the URL do this:
	if ($_GET['page'] == 'news'){ // if the variable 'page' is equal to 'news' (  /index.php?page=news ) then 
	// echo out all the information regarding that page
	echo ("<div id=\"main\"><div id=\"column\">	<div id=\"featuredproperty\"></div></div><div id=\"content\"></div></div>"); 
	} else if ($_GET['page'] == 'something'){ // if the variable 'page' is equal to 'something' (  /index.php?page=something ) then 
	// echo out all the information regarding that page
	echo ("<div id=\"main\"><div id=\"column\">	<div id=\"featuredproperty\"></div></div><div id=\"content\"></div></div>"); 
	} else if ($_GET['page'] == 'properties'){ // if the variable 'page' is equal to 'properties' (  /index.php?page=properties ) then 
	// echo out all the information regarding that page
	echo ("<div id=\"main\"><div id=\"column\">	<div id=\"featuredproperty\"></div></div><div id=\"content\"></div></div>"); 
	}

} else {
header( 'Location: ?page=news' ) ;
// or something to this extent, I dont think this works out of the HTML <head> tags.
}
// end the PHP
?>

 

Cheers

Sean

Link to comment
Share on other sites

I get this error:

 

Warning: Cannot modify header information - headers already sent by (output started at /Users/lesbrown/Sites/site1/test.php:8) in /Users/lesbrown/Sites/site1/test.php on line 33

 

if you use header(), it must be before ANY output to the browser, including HTML. you need to check $_GET['page'] and header() if necessary before you use <!DOCTYPE>

Link to comment
Share on other sites

k, new code....

 

<?php // start the PHP
if (isset($_GET['page'])){ // if the variable 'page' is set in the URL do this:
	if ($_GET['page'] == 'news'){ // if the variable 'page' is equal to 'news' (  /index.php?page=news ) then 
	// echo out all the information regarding that page
	echo ("<div id=\"main\"><div id=\"column\">	<div id=\"featuredproperty\"></div></div><div id=\"content\"></div></div>"); 
	} else if ($_GET['page'] == 'something'){ // if the variable 'page' is equal to 'something' (  /index.php?page=something ) then 
	// echo out all the information regarding that page
	echo ("<div id=\"main\"><div id=\"column\">	<div id=\"featuredproperty\"></div></div><div id=\"content\"></div></div>"); 
	} else if ($_GET['page'] == 'properties'){ // if the variable 'page' is equal to 'properties' (  /index.php?page=properties ) then 
	// echo out all the information regarding that page
	echo ("<div id=\"main\"><div id=\"column\">	<div id=\"featuredproperty\"></div></div><div id=\"content\"></div></div>"); 
	}

} else {
		echo ("hi!");	// or something to this extent, I dont think this works out of the HTML <head> tags.
}
// end the PHP
?>

 

 

though, I still dont know how to fix this first error...

 

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/holiday/public_html/new/index.php on line 23

 

Cheers

Sean

Link to comment
Share on other sites

code should be:

 

<?php
  if(!isset($_GET['page'])){ // if the variable 'page' is set in the URL do this:
    header('Location: ?page=news');
    exit;
  }
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    
    <title>TWO-COLUM FIXED LAYOUT WITH FIXED BOXES</title>
    
    <style type="text/css">
          @import url("main.css");
    </style>
    
  </head>
  <body>
    <div id="pagewrapper">
      <div id="header">
      </div>
      <div id="nav">
      </div>
<?php // start the PHP
  if ($_GET['page'] == 'news'){ // if the variable 'page' is equal to 'news' (  /index.php?page=news ) then 
  // echo out all the information regarding that page
  echo ("<div id=\"main\"><div id=\"column\"> <div id=\"featuredproperty\"></div></div><div id=\"content\"></div></div>"); 
  } else if ($_GET['page'] == 'something'){ // if the variable 'page' is equal to 'something' (  /index.php?page=something ) then 
  // echo out all the information regarding that page
  echo ("<div id=\"main\"><div id=\"column\"> <div id=\"featuredproperty\"></div></div><div id=\"content\"></div></div>"); 
  } else if ($_GET['page'] == 'properties'){ // if the variable 'page' is equal to 'properties' (  /index.php?page=properties ) then 
  // echo out all the information regarding that page
  echo ("<div id=\"main\"><div id=\"column\"> <div id=\"featuredproperty\"></div></div><div id=\"content\"></div></div>"); 
  }
?>
      <div id="footer">
      </div>
    </div>
  </body>
</html>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.