Page disappears

OK, I certainly don’t understand this.
Created an html page for a login form. Looks fine.
Put <?php //going to add validation code here ?>
above the DOCTYPE just like it says to do in my PHP Solutions book.
Going to write some PHP to validate a login on this page.
Now, when I publish the page, all I see is the code listing.

Can anyone please tell me what I’m doing wrong?
Thanks!

PHP is server side, you won’t be able to see code like you can HTML elements/tags or JavaScript. That is why you should have errors turned on to help you debug your PHP code.

MooKraTeem, your comment does not help and does not ask a question.

But, to expand on Strider64’s good explaination…

PHP is as Strider mentioned SERVER-SIDE code only. What this means is that PHP is processed on the
server BEFORE it is sent out to the browser. ALL output of PHP is handled on the server and it is then
combined with your HTML and sent out to the browser. At that point the browser takes the HTML code
with any outputs of the PHP code and “renders” it into something viewable and finally runs any JS, JQUERY
and of course the CSS styling codes.

Therefore, you will NEVER see any PHP code inside the browser. This is done by design to secure the
PHP code somewhat so that it is mostly hidden from the user. Hope this helps to further explain it.

What do you mean you “see the code listing”?

You see the actual code? Do you have PHP installed and it is running properly? Is the file a PHP extension and not a html page?

Astonecipher, didn’t even think of that… Yes, bet he made it an .HTML and not a .PHP !
Sometimes we (I) forget the simplest things first… LOL good catch !

Sponsor our Newsletter | Privacy Policy | Terms of Service