Adding PHP code to an HTML document allows you to create dynamic, interactive web pages. You can add PHP code to an existing web page or to a new HTMl document you create.
PHP code is inserted into HTML code using the <?php opening delimeter and the ?> closing delimeter. The delimeters tell the server where the PHP code begins and ends.
You can add multiple sections of PHP code to an HTML document. You must use an opening and closing delimeter for each section of code. If the PHP code will generate ouput for display in a user's web browser, you can use HTML tags to format the output.
PHP code used to generate ouput must be inserted between the <body> and </body> tags. When a web server recieves a request for a web page containing PHP, the web server processes all the code found between the PHP delimeters.
The information generated by the PHP code is inserted into the web page before the page is sent to a user's web browser. Users who visit the page will not be able to see the PHP code, even if they display the source code for the page. When savijng a PHP page you have crated, you must add the .php extension to the filename of the page.
Some text editors do not recognize the .php extension, so you may have to enclosethe filename in quotation marksm such as "index.php". The PHP page must be saved in the appropriate location on your web server before the page can be displayed.
Comments
Post new comment