Echo not allowing me to use ' inside the "s

Discussion in 'PHP' started by shendraeg, Oct 4, 2008.

  1. #1
    I just installed PHP on my server, and I tried running a simple script, but it keeps choking as soon as it hits the first Echo statement:

    <?php>
    
    echo "
    <html>
    <body bgcolor='#000000'>";
    PHP:
    Playing with it a little bit, I've found that it just doesn't like any echo statement where I try putting single quotes inside of the double quotes. I've written code like this that has worked on several other servers, but it just isn't working on mine. Any ideas?
     
    shendraeg, Oct 4, 2008 IP
  2. Masterful

    Masterful Well-Known Member

    Messages:
    1,653
    Likes Received:
    28
    Best Answers:
    0
    Trophy Points:
    140
    #2


    Your opening tag is wrong, and you need to put a backslash before the quotation marks:

    <?php
    
    echo "<html><body bgcolor=\"#000000\">";
    
    ?>
    PHP:
     
    Masterful, Oct 4, 2008 IP
  3. shendraeg

    shendraeg Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I literally just caught the opening tag. It's been too long since I've written PHP code. The rest of it is ok though, for whatever it's worth. Thanks.
     
    shendraeg, Oct 4, 2008 IP
  4. kind_of_the_cash

    kind_of_the_cash Active Member

    Messages:
    852
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    85
    #4
    
    <?php
    echo "some thing you want";
    ?>
    
    PHP:
    lol php isn't html in html you open tags like
     
    kind_of_the_cash, Oct 4, 2008 IP