QuickStart PHP: PHP Hypertext Preprocessing                         

by Matt Murphy and Dublas Portillo

Step-by-step instructions for learning to program with PHP


 About the language                                                    

Name:  PHP
Year created: 1994
Created by: Rasmus Lerdorf
Paradigm: Object Oriented and Procedural
Platform: Works on Unix, Mac OS X, and Microsoft Windows
Domain:  
Advantages: Very Efficient, Database Integration, Built-in Libraries, its free, Easy to Learn, Portable,
Disadvantages: Limited offline application functionality
Specification: http://www.php.net/manual/en/
Grammar:  

Step 1: Downloading the required files

Step 2: Installing Apache2 Step 3: Installing the PHP files Step 4: Hello World Program Step 5: Title Creator.php

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Title Creator</title>
<style type="text/css">
<!--
body,td,th {
font-family: Arial, Helvetica, sans-serif;
}
-->
</style></head>
<?php
$title = stripslashes($HTTP_POST_VARS["title"]);
$author = $HTTP_POST_VARS["author"];
$size = $HTTP_POST_VARS["size"];
$bgcolor = $HTTP_POST_VARS["bgcolor"];
$textcolor = $HTTP_POST_VARS["textcolor"];

if(isset($title) && isset($author) && isset($size) && isset($bgcolor) && isset($textcolor)) {
echo "<body bgcolor=$bgcolor text=$textcolor>";
echo "<center>";
echo "<$size>$title</$size>";
echo "<h5>$author</h5>";
echo "</center>";
echo "<p align=left></p>";
} else {
echo "<body>";
}
?>
<center>
<table width="75%" border="1" bordercolor="#999999">
<tr>
<td><form name="form1" method="post" action="testphp.php">
<p>Title of the page:
<input name="title" type="text" id="title" size="50">
Size:
<select name="size" id="size">
<option value="h1">Big</option>
<option value="h3">Medium</option>
<option value="h5">Small</option>
</select>
</p>
<p>Author:
<input name="author" type="text" id="author" size="50">
</p>
<p>Background color:
<label> </label>
</p>
<label>
<input type="radio" name="bgcolor" value="red">
red</label>
<br>
<label>
<input type="radio" name="bgcolor" value="blue">
blue</label>
<br>
<label>
<input type="radio" name="bgcolor" value="black">
black</label>
<br>
<label>
<input type="radio" name="bgcolor" value="white">
white</label>
<p>Text color: </p>
<p>
<label>
<input type="radio" name="textcolor" value="white">
white</label>
<br>
<label>
<input type="radio" name="textcolor" value="#FFCC00">
yellow</label>
<br>
<label>
<input type="radio" name="textcolor" value="black">
black</label>
</p>
<p><br>
<input type="submit" name="Submit" value="Submit">
<input type="reset" name="Reset" value="Reset">
</p>
</form></td>
</tr>
</table>
</center>
</body>
</html>

 

 Learning more                                                        

There is a vast amount of information available on the Internet.  Some of the best sources are:

 QuickStart Presentation                                           

Download and view the QuickStart PHP Powerpoint Presentation.

Back to QuickStart Languages