Can anyone tell me why I am getting this PHP error?

Discussion in 'PHP' started by ACrofford, Jun 5, 2008.

  1. #1
    I am trying to setup a template system with a header.php and footer.php. That way I can just update the header and footer php files to update the entire site. It worked fine until I added the following to put a unique page title and keywords for each page.

    This is the error I am getting:

    Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in /home/bans1/public_html/header.php on line 28
    PHP:
    Here is line 27 and 28

    <?php if (isset($description)) {
    echo "<meta name=\"description\" content=\"".$description"\">";}?>
    PHP:
    Your help is appreciated.

    Thanks,
    AC
     
    ACrofford, Jun 5, 2008 IP
  2. Agent_Smith

    Agent_Smith Well-Known Member

    Messages:
    890
    Likes Received:
    43
    Best Answers:
    0
    Trophy Points:
    145
    #2
    
    <?php if (isset($description)) {
    echo '<meta name="description" content="'.$description.'">';
    }
    ?>
    
    PHP:
     
    Agent_Smith, Jun 5, 2008 IP
  3. alvas

    alvas Peon

    Messages:
    17
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    you're missing concatenation dot after $description variable

    <?php if (isset($description)) {
    echo "<meta name=\"description\" content=\"".$description."\">";}?>
     
    alvas, Jun 5, 2008 IP
  4. ACrofford

    ACrofford Active Member

    Messages:
    272
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    60
    #4
    Thanks guys. It works now.
     
    ACrofford, Jun 5, 2008 IP