strange php error

Associate
Joined
3 Aug 2006
Posts
610
Location
London, UK
just finished my site in php and can't find any errors in the code but whenever I try to open it in my browser I get the error:
Parse error: syntax error, unexpected $end in C:\Program Files\xampp\htdocs\london-dude 1.1\index2.php on line 46

I realise that it seems to be pointing at an error in line 46 but all i have on that line is "</HTML>"

my code is:
PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">

<html>

   <head> 
      <title>London Dude</title>
      <link rel="stylesheet" type="text/css" href="mainstyles.css" />
<?php
    $index = "frontpage.php";               //Index Page
    $about = "about.php";                   //About Page
    $portfolio = "portfolio.php";			//Portfolio Page
    $contact - "contact.php";				//Contact Page
    
if(!isset($_GET['p']) || $_GET['p'] == 'home') { 
$page = $index;        //Default Page
} else if($_GET['p'] == 'about') {
$page = $about;
} else if($_GET['p'] == 'portfolio') {
$page = $portfolio;
} else if($_GET['p'] == 'contact') {
$page = $contact;
?>
   </head>

   <body>
        <div class="topbar">
            <img alt="London Dude" src="images/logowinter.jpg" />
        </div>
        <div class="menubar">
        <a href="index.php"><img alt="Home |" src="images/home.jpg" /></a>
        <a href="index2.php?p=about"><img alt=" About |" src="images/about.jpg" /></a>
        <a href="index2.php?p=portfolio"><img alt=" Portfolio |" src="images/portfolio.jpg" /></a>
        <a href="index2.php?p=contact"><img alt=" Contact |" src="images/contact.jpg" /></a>
        </div>
        <center>
            <div class="body">
                <?php
    include($page);
?>
			<div class="copy">
            <p>All content of this site is Copyright © Mitchel Moriarty 2006 Unless Otherwise Stated</p>
            </div>
            </div>
        </center>
   </body>
</html>
 
I think this is because you're missing a curly bracket here:-

Code:
else if($_GET['p'] == 'contact') { 
$page = $contact;

change to:-

Code:
else if($_GET['p'] == 'contact') { 
$page = $contact;
}
 
Back
Top Bottom