Login | Help Menu | Back to F525

Learn about PHP

What is PHP

PHP is a Server-side HTML embedded scripting language used by web develops to create dynamic websites. Unlike HTML where the code is processed by the end users computer; PHP is processed by the server the code is accessed from.

Simple PHP

To start creating PHP you should open Notepad, WordPad or any simple editing program.

Text

To output simple text we will use the echo tag, anything between the speech marks will be displayed as the output. If you wanted to use speech marks in you output you will need to add a backslash next to the speech mark (\").

 
  <?
echo 
"Hello World";
?>
 
 

Saving

When saving your PHP page you will need to save the page in the ".php" format, this can be done by entering your page name with ".php" on the end like in this example.
 
   
 

 


Viewing

To view your page you will need to upload the PHP file onto the server. Once the file is uploaded you can view the page by navigating to http://YourDomain.co.uk/Example.php

Your page should display as

 
  Hello World  
 

Advanced Options

When using the Echo tag we can also use HTML tags to format your text simply by adding tags like <B> to the start and </B> will make the text bold (Example 1). When you need to output speech marks in you text you will need to add a backslash to the speech mark (Example 2) this will also work for HTML tags that require speech marks (Example 3).

 
  <?
echo 
"<B>Hello World</B>";

echo 
"She said \"Hello World\""
;
echo "<font face=\"red\">Hello World</font>";

?>
 
 

Your page should display as

 
  Hello World
She Said "Hello World"
Hello World
 
 

You should now be able to add text to your pages, on the next page you will learn about MYSQL databases.

 
 

© F525 NET 2010