|
-
Aug 2nd, 2009, 07:16 PM
#1
Thread Starter
Frenzied Member
[RESOLVED] PHP at begining of HTML document?
Hello here is my code:
Code:
<?php
session_start();
if (isset($_SESSION['loggedon']) == false){
header('Location: /index.html');
}
?>
<html>
<body>
Secret Content!
</body>
</html>
This is a .html page. My php code is not be processed. The loggedon is not set which should cause the header to execute, but instead nothing happens. As well when you viewsource the page you can see the php code. Is it not valid to place PHP code before the html tags? If it isn't valid then where do I put the session_start();? Where do I put my php code?
-
Aug 2nd, 2009, 07:19 PM
#2
Re: PHP at begining of HTML document?
the file needs to be .php
-
Aug 2nd, 2009, 07:23 PM
#3
Thread Starter
Frenzied Member
Re: PHP at begining of HTML document?
And I can still have the html tags?
-
Aug 2nd, 2009, 08:36 PM
#4
Re: PHP at begining of HTML document?
yes. PHP files can contain all php, all html, or php and html together.
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
|