Changes

Jump to: navigation, search

Creating a Simple PHP Script

12 bytes added, 14:18, 24 May 2007
Embedding HTML into a PHP Script
In the previous example we embedded some PHP scripts into an HTML web page. We can reverse this by putting the HTML tags into the PHP commands. The following example contains a PHP script which is designed to output the HTML necessary to display a simple page. As with the previous examples, create this file, uplaod it to your web server and load it into a web browser:
<pre>
<?php
echo "<html>\n";
echo "</html>\n";
?>
</pre>
When you laod this into your browser it will be as if all that was in the file was HTML, and if you use the ''view source'' feature of your browser the HTML is, infact, all you will see because the PHP pre-processor simply created the HTML it was tolf to create when it executed the script:

Navigation menu