|
PHP stands for PHP Hypertext Preprocessor, which fits right in with the trend of self-referencing abbreviations. But what is it?
It's a programming language that will allow you to create dynamic content on your website. It works things out on the web server before churning out the web page that has been requested. It might be best if I give you an example of that:
you might have a form on your web site that allow the user to select a product and a quantity, when the click the submit form button you want a program to show them what they have selected and the price of the selection and then a total price.
the form code might look like this :
<html>
<body>
<form name='products' action='addup.php' method='GET'>
products: <select name='product'>
<option value='handbag'>handbag</option>
<option value='comb'>comb</option>
<option value='spanner'>spanner</option>
</select>
<br>
Quantity<input type='text' name='quantity'>
<br>
<input type='submit'>
</form>
</body>
</html>
The php script (addup.php) the form is sent to in the 'action' part of the form might look like this:
<?
if ($product == 'handbag')
{
$price = 1;
}
else if ($product == 'comb')
{
$price = 2;
}
else if ($product == 'spanner')
{
$price = 3;
}
$total = $price * $quantity;
print "you choose: $quantity $product (s)
with a total of: $total
";
?>
 by Pete |