This PHP Tutorial demonstrates just how easy it is to create dynamic websites using PHP.

Before starting this tutorial, you should have experience with HTML. If you aren't comfortable with HTML, start with the HTML Tutorial first, then return to this page to learn PHP!

Oh, it would also help if you have some scripting knowledge (such as JavaScript, VBScript etc), but this isn't essential.

Table of Contents

This PHP tutorial is separated into the following sections:

Basic PHP

PHP Installation
PHP Syntax
PHP Variables
PHP Form Variables
PHP If Statements
PHP Switch Statements
PHP Arrays
PHP While Loops
PHP For Loops
PHP Operators
PHP Functions

Advanced PHP

PHP Include
PHP Upload File
PHP File
PHP Mail
PHP Mail Configuration
PHP Database Driven Website

Download Now
  • Date: Nov 27, 2012

PHP Introduction

What Is PHP?

PHP (PHP: Hypertext Preprocessor) is a server-side scripting language intended to help web developers build dynamic web sites quickly.

How Does PHP Work?

PHP scripts are executed on the server, before the web page is displayed to the user (this is what we mean by "server-side"). The user only sees the end result, which consists of client-side markup and scripts (i.e. HTML, JavaScript, CSS etc). Therefore, the user/browser doesn't actually see any PHP code. If the user views the source code, all they would see is HTML, JavaScript, CSS etc - they wouldn't see any PHP code.

This happens because, whenever the server processes a file with the .php extension, it knows to look for PHP code. When it encounters the PHP code, it processes it. Generally, the same .php file will also have client side code such as HTML. The server knows to process the PHP bits and output the client-side bits. You, as the programmer, determine which pieces of HTML will be displayed and when. You do this using PHP code.

What Can PHP Do?

PHP enables you to build large, complex, and dynamic websites. PHP can also increase your productivity enormously, both in development time and maintenance time.

Using PHP, you can build websites that do things such as:

Query a database
Allow users to upload files
Create/read files on the server (for example, the files that your users upload)
Have a "member's area" (i.e. via a login page)
Have a shopping cart
Present a customized experience (for example, based on users' browsing history)
Much, much more

What Do I Need to Create PHP Code?

You can create PHP code using the same equipment you use when creating HTML. That is, a computer with the following software:

Text editor. For example, Notepad (for Windows), Pico (for Linux), or Simpletext (Mac). You could use a special HTML or PHP editor if you like but it's not needed.
Web Browser. For example, Internet Explorer or Firefox.

What Do I Need to Run PHP?

To run the PHP pages you create, you need a computer with the following software:

A web server (such as IIS, Apache etc)

If you don't have these installed, you have a couple of options (apart from giving up!). The next lesson will point you in the right direction.

  • Date: Nov 29, 2012

Uhm.. You have really Shown that you gat Concept, Bravo G-COLE and Cheatmaster