|
-
May 14th, 2010, 03:49 PM
#1
Thread Starter
Junior Member
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
-
May 14th, 2010, 04:00 PM
#2
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.
-
May 28th, 2010, 11:41 AM
#3
Frenzied Member
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|