Help!! Error in PHP

Discussion in 'PHP' started by buckmajor, May 22, 2008.

  1. #1
    Hi there

    I figured out how to use include PHP but one of my page is displaying correctly.

    Link

    Here is my code with error on the about1.php

    <?php 
    $title='About';
    
    include('includes/header1.php');
    
    echo '
    <div id="content">
    		<h2>About us</h2>
    			<div id="contentleft" class="orange">
    				
    				<p>The Bowen Terrace provides fun and friendly, yet quiet and affordable accommodation for travellers from all over the world.
    		  Family owned and operated, The Bowen Terrace will provide you with that "home away from home" feel; a warm and hospitable atmosphere.</p>
    
    
    	  <p>The house itself is what is commonly referred to in Australia as a <a href="http://www.google.com" target="_blank">Google</a>.
    		With it's timber construction, corrugated iron roofing, front and back
    		verandahs, and traditional architecture, you'll experience a part of the
    		typical <a href="http://www.google.com" target="_blank">Google</a>
    		lifestyle.</p>
    
    		  <p>When you're relaxing out on the back deck on a warm summer's evening, drinking an <a href="http://www.google.com" target="_blank">Google</a>, listening to the mangos drop from the tree onto the roof, you'll see just how laid-back this city can be.
    		  But then notice why the locals refer to the city as "Bris Vegas" as the city lights illuminate the beautiful <a href="http://www.google.com" target="_blank">Google</a> skyline.
    		  But don't worry, you're only a hop-skip-and-a-jump away from the <a href="http://www.google.com" target="_blank">Google</a>.<br />
    <br />
    		  Nice</p>
    
    		  <h3>Links / Reviews</h3>
    		  <ul>
    		  	<li><A HREF="http://www.phpinclude.digitalprodusa.net" target="_blank">Test</A></li>
    		  	<li><A HREF="http://www.phpinclude.digitalprodusa.net" target="_blank">Test</A></li>
    		  </ul>
    			</div>
    			
    			<div id="contentright">
    			<img src="img/photo-family.jpg" width="200" /></div>
    </div>
    ';
    
    include('includes/footer1.php'); 
    
    ?>
    Code (markup):
    This code works on index1.php

    <?php 
    $title='Home';
    
    include('includes/header1.php');
    
    echo '
    <div id="content">
    		<h2>Our home page</h2>
    			<div id="contentleft">
    				<img src="img/photo-front-normal.jpg" width="420" /></div>
    			<div id="contentright">
    			
    				<div id="home">
              			<ul>
                			<li>Single or share rooms</li>
                			<li>Double rooms with fridge, TV, with or without bathrooms</li>
                			<li>Residents lounge and BBQ deck</li>
                			<li>Cooking and laundry facilities</li>
                			<li>100 metres to theatre, coffee shops, and restaurants</li>
                		<li>Public transport at the door</li>
                		<li>Shuttle bus service — discount rates.</li>
              			</ul>
            		</div>
    			</div>
    		</div>
    ';
    
    include('includes/footer1.php'); 
    
    ?>
    Code (markup):
    So what am I doing wrong?

    Much help is appreciated.

    CHEERS :)
     
    buckmajor, May 22, 2008 IP
  2. TeraTask

    TeraTask Peon

    Messages:
    37
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You're inside of a string which opens with an apostrophe, so you can't just do

    Instead, you need to escape the quote:

     
    TeraTask, May 22, 2008 IP
  3. ashbeats

    ashbeats Active Member

    Messages:
    72
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    91
    #3
    Since the chunk of html does not get processed by the php, why
    don't you leave it as html and separate the php sections.

     
    ashbeats, May 22, 2008 IP
  4. elias_sorensen

    elias_sorensen Well-Known Member

    Messages:
    852
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    110
    #4
    Yeah, it's the apostroph in it's that makes the error, since you start your echo by a apostroph too.

    Use it\'s or change your start and end of echo to echo "....";.
     
    elias_sorensen, May 22, 2008 IP
  5. kasapa

    kasapa Peon

    Messages:
    86
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5
    That OK for the solution?
     
    kasapa, May 23, 2008 IP
  6. buckmajor

    buckmajor Active Member

    Messages:
    574
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    58
    #6
    Ok whats the difference they both do the same except that the echo code you have to add the slash before the apostrophe
    It/'s annoying
    Code (markup):
    which takes a bit longer to do. Is this correct?

    So is it better to use this one right?

    <?php 
    $title='About';
    include('includes/header1.php');
    ?>
    ..HTML content...
    <? include('includes/footer1.php'); ?>
    Code (markup):
    Instead of this one

    <?php 
    $title='Home';
    
    include('includes/header1.php');
    
    echo '
    ....HTML content...
    ';
    
    include('includes/footer1.php');
    
    ?>
    Code (markup):
     
    buckmajor, May 23, 2008 IP
  7. TeraTask

    TeraTask Peon

    Messages:
    37
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Just adding some text here because it wouldn't let me post without doing so.
     
    TeraTask, May 23, 2008 IP
  8. buckmajor

    buckmajor Active Member

    Messages:
    574
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    58
    #8
    Thank T

    That link is what I was after.

    Much appreciated.

    CHEERS:)
     
    buckmajor, May 26, 2008 IP