Results 1 to 3 of 3

Thread: PHP not showing echo messages?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2009
    Posts
    19

    Question PHP not showing echo messages?

    Hey guys,

    I've got a problem where my page, after you login, only displays normal HTML and not PHP code. Here is the code, I don't know what is wrong. Thank you.

    Code:
    <? 
    session_start();
    
    echo "This doesn't show either";
    
    if(!session_is_registered(myusername)){
    header("location:index.php");
    }
    
    
    
    ?>
    
    <html>
    <body>
    <p>Login Successful :D</p>
    </body>
    </html>
    Thanks,

    -Francis

  2. #2
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: PHP not showing echo messages?

    view the source. I bet the source you get is everything you posted (PHP included, which shouldn't happen normally). your script is most likely not even being parsed. short tags are (possibly, I forget) deprecated -- but even if they aren't, they're sort of bad practice to use because not all servers enable short tags. thus, you should be using the full <?php opening tag.

  3. #3
    Frenzied Member
    Join Date
    Dec 2007
    Posts
    1,072

    Re: PHP not showing echo messages?

    It depends on the short_open_tag setting in your php.ini. The idea of using a (long) tag is a very good idea as it gives your code portability to servers where short_open_tag is Off. Here's a way to check if short_open_tag is on or off:
    PHP Code:
    <?PHP
        
    echo 'Short-Tag usage is <strong>',(ini_get('short_open_tag') == 'on.' 'off.'),'</strong>';
    ?>
    Alternatively, you can CTRL+F through phpinfo() for short_open_tag.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width