(
PHP:
Hypertext
Preprocessor) An extremely popular scripting language that is used to create dynamic Web pages. Combining syntax from the C, Java and Perl languages, PHP code is embedded within HTML pages for server side execution. It is commonly used to extract data out of a database on the Web server and present it on the Web page. Originally known as "Personal Home Page," PHP is supported by all Web servers and widely used with the MySQL database. See
MySQL.
The following example converts Fahrenheit to centigrade in PHP, which is used in conjunction with HTML (identified in
boldface). The HTML code gets the number from the user, and the PHP performs the calculation.
<?php
if($_POST{
$fahr = $_POST['fahr'];
$celsius = ($fahr - 32)*5/9;
}
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=UTF-8">
<title>Fahrenheit to Celsius</title>
</head>
<body>
<form action="" method="post">
Enter Fahrenheit: <input type="text"
name="fahr" /><br />
<?php
if(isset($celsius)){
echo "Celsius = ".$celsius;
}
?>
</form
</body>
</html>