Thursday, May 5, 2016

Creating PHP Page

This tutorial is a contiuation of my first tutorial, the setting up your own web server.

In this tutorial, we will create a test page.


This page will be composed of html and php.

PHP by the way is a server-side scripting language.

Now we will create a php page.

Go to the installation directory of your WAMP Server, then go to 'www' and let's create another directory inside. Let's call it 'TestDirectory'.

Inside this directory, create a file called 'index.php' and paste the below code.

Now, save that file and go to your browser. Input in the address bar 'localhost/TestDirectory' and you
should see a page with a word "Hello World" in it.

Now that is our first page created using PHP and HTML.

Code Explanation:
1. The code on line #1 indicates the start of our html page, and ends at line #9 with the syntax </html>
2. Line #2 create a title of the page "Test Page". You will see this on the tab of a web browser.
3. Line #3 denotes the start of the body of html page and ends at line #8.
4. Line #4 indicates the start of our php code. every php code must start with "<?php" 
    and ends with "?>.
5. On line #5, we declared a variable called $text and assigned a value "Hello World".
6. On line #6, the echo syntax displays the content of the variable $text.

That's all for the test page folks... I hope this helps a bit...

No comments:

Post a Comment