A common - novice - misunderstanding about PHP is that it does something that replaces HTML. If you are putting PHP into your HTML page and it is just showing up there, not doing anything, read on.
In the past you have probably developed HTML pages. What you need to know is that PHP does not replace HTML. It works with HTML to produce content that can vary for reasons that you decide.
HTML is the language that each of the browsers - Firefox, Safari, Internet Explorer (IE) and all the others - receive to know how to display a page to the user. This is called "Client Side" code - code that the browser receives and processes to display a page. A html page will typically end in .htm or .html [e.g. index.htm or index.html].
PHP is a "Server Side" language meaning that it is processed on the server prior to anything being sent to the browser. PHP code, that does something, is NEVER sent to the browser. It performs a function on the server prior to sending HTML or text to the browser. A php page should always end in .php [e.g. index.php]. In some cases older versions of php ended with an extension containing the version number like php3, but unless you have an exceptional reason yours will not.
If your php code is just showing up on the page and not doing anything, usually, it is because the filename of your page is incorrect. In order for the php code to render the page must end in .php NOT .htm or .html
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment