PLEASE STAND BY

LOADING WEBPAGE


PHP TUTORIAL


What is PHP?

"PHP is an HTML-embedded scripting language. Much of its syntax is borrowed from C, 
Java and Perl with a couple of unique PHP-specific features thrown in. The goal of 
the language is to allow web developers to write dynamically generated pages quickly."


What do You need?

In this tutorial we assume that your server has activated support for PHP and that 
all files ending in .php are handled by PHP. On most servers, this is the default 
extension for PHP files, but ask your server administrator to be sure. If your server 
supports PHP, then you do not need to do anything. Just create your .php files, put 
them in your web directory and the server will automatically parse them for you.


PHP script: hello.php


<html>
 <head>
  <title>PHP Test</title>
 </head>
 <body>
 <?php echo '<p>Hello World</p>'; ?>
 </body>
</html> 
This file will be parsed by PHP and the output will be sent to your browser:

<html>
 <head>
  <title>PHP Test</title>
 </head>
 <body>
 <p>Hello World</p>
 </body>
<s/html>
Forms One of the most powerful features of PHP is the way it handles HTML forms. A simple HTML form

<form action="doAction.php" method="post">
 <p>Your name: <input type="text" name="name"/></p>
 <p>Your age: <input type="text" name="age"/></p>
 <p><input type="submit"/></p>
</form>
This is just straight HTML form with no special tags. When the user fills in this form and hits the submit button, the doAction.php page is called. In this file you would write something like this: Printing data from your form

Hi <?php echo $_POST['name']; ?>.
You are <?php echo $_POST['age']; ?> years old
Output of this script may be:

Hi Joe. You are 22 years old.