PHP Lessons

Let's start!

As we previously said, you can embed the PHP code in the HTML code, and, viceversa, you can insert the HTML code in the PHP code.

The last feature can be done by the echo instruction.

Open your text editor and write (inside the HTML file) your first PHP row.
Here you can see two examples:

<body>
<?php
echo"Hello!";
?>
</body>
<body>
<?php
echo"<b>Hello!</b> <br /> What's your name?";
?>
</body>
elephpant (8K)

Look at the syntax of the echo instruction:

Save the file as test.php, but don't try to execute the program in your local computer by clicking on it!

If you click on a .php file, the operating system will ask you for the program you want to use. Sometimes the note pad is automatically opened and you can see the code only.

If you want to execute your PHP program, you must publish it in the server!

When you search for it by the URL in the browser, the PHP module will create immediately a HTML page wich you can see in your browser.

What's the benefit?
For the present no one, in order to have some interactivity we must introduce the variables.

Valid HTML 4.01 Transitional