PHP FAQ
This document is intended to teach you the
basics of using PHP within your web pages. The
official PHP
website is also a very good place to
start. In order to get the most from this document
and PHP in general a very good understanding
of HTML is required.
What In The World is
PHP?
PHP is a scripting language similar to Perl
that lets you create dynamic web pages. PHP
can be inserted right into your HTML code. PHP-enabled
web pages are treated just like regular HTML
pages and you can create and edit them the same
way you normally create regular HTML pages.
PHP Basics (Using PHP)
In order to use PHP
you must give your html files a .php extension
instead of the regular .html or .htm extension.
This tells our servers that you have PHP code
within your pages so we can handle them properly.
Once you have given your
file a .php extension you can begin to use PHP
code. PHP is placed between special comment
tags within your HTML code. A typical PHP command
looks like this: <?php
echo "hello world"; ?>
Does this seem confusing?
Here is some example PHP code and what it looks
like on screen. You can simply copy and paste
from here if you wish.
Browser
Output (on screen) |
PHP
Code |
The Current
Date and Time: Thursday,
08-Apr-2004 11:28:40 EDT |
The Current
Date and Time: <?php
$current=date("l, d-M-Y H:i:s T");
echo "$current"; ?> |
The Previous
Web Page: http://www.jinfo.net/support |
The Previous
Web Page: |
Your IP Address:
80.140.137.6 |
Your IP Address:
|
Your Browser
Type and OS: Mozilla/4.0
(compatible; MSIE 6.0; Windows 98) |
Your Browser
Type and OS: |
Learning More
We would recommend you look at the official
PHP tutorial located at: http://www.php.net/tut.php
PHP Troubleshooting
Q - I have placed PHP code within my HTML
file and I see the code in my browser window
or nothing happens.
A - Make sure the extension of your HTML
file .php and not .html or .htm
A - make sure you have enclosed your
code between the PHP tags.
|