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
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.
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') == 1 ? 'on.' : 'off.'),'</strong>';
?>
Alternatively, you can CTRL+F through phpinfo() for short_open_tag.