Monday, January 7, 2008

PHP Tutorial-Part 1 - Introduction

Part 1 - Introduction
Part 2 - Displaying Information & Variables
Part 3 - IF Statements
Part 4 - Loops and Arrays
Part 5 - E-mail With PHP
Part 6 - PHP With Forms
Part 7 - Final Notes

The Essential Guide to Dreamweaver CS3 with CSS, Ajax, and PHPBy: David Powers$29.99
Beginning PHP and MySQL 5: From Novice to Professional, Second EditionBy: W. Jason Gilmore$26.99
Pro Drupal DevelopmentBy: John K. VanDyk, Matt Westgate$29.69
Programming PHPBy: Rasmus Lerdorf, Kevin Tatroe, Peter MacIntyre$26.39
IntroductionUp until recently, scripting on the internet was something which very few people even attempted, let alone mastered. Recently though, more and more people have been building their own websites and scripting languages have become more important. Because of this, scripting languages are becomming easier to learn and PHP is one of the easiest and most powerful yet.What Is PHP?PHP stands for Hypertext Preprocessor and is a server-side language. This means that the script is run on your web server, not on the user's browser, so you do not need to worry about compatibility issues. PHP is relatively new (compared to languages such as Perl (CGI) and Java) but is quickly becomming one of the most popular scripting languages on the internet.Why PHP?You may be wondering why you should choose PHP over other languages such as Perl or even why you should learn a scripting language at all. I will deal with learning scripting languages first. Learning a scripting language, or even understanding one, can open up huge new possibilities for your website. Although you can download pre-made scripts from sites like Hotscripts, these will often contain advertising for the author or will not do exactly what you want. With an understanding of a scripting language you can easily edit these scripts to do what you want, or even create your own scripts.Using scripts on your website allows you to add many new 'interactive' features like feedback forms, guestbooks, message boards, counters and even more advanced features like portal systems, content management, advertising managers etc. With these sort of things on your website you will find that it gives a more professional image. As well as this, anyone wanting to work in the site development industry will find that it is much easier to get a job if they know a scripting language.What Do I Need?As mentioned earlier, PHP is a server-side scripting language. This means that, although your users will not need to install new software, you web host will need to have PHP set up on their server. It should be listed as part of your package but if you don't know if it is installed you can find out using the first script in this tutorial. If you server does not support PHP you can ask your web host to install it for you as it is free to download and install. If you need a low cost web host which supports PHP I would recommmend HostRocket.Writing PHPWriting PHP on your computer is actually very simple. You don't need any specail software, except for a text editor (like Notepad in Windows). Run this and you are ready to write your first PHP script.Declaring PHPPHP scripts are always enclosed in between two PHP tags. This tells your server to parse the information between them as PHP. The three different forms are as follows:

No comments: