Page 19 - Open Soource Technologies 304.indd
P. 19
Unit 1: Introduction to PHP
1.4.1 Configuration Page Notes
The PHP function phpinfo( ) creates an HTML page full of information on how PHP was installed.
You can use it to see whether you have particular extensions installed, or whether the php.ini file
has been customized. Example is a complete page that displays the phpinfo( ) page.
Using phpinfo( )
Figure 1.7 shows the first part of the output of the given above example.
<?php phpinfo( ); ?>
Figure 1.7 Partial Output of Phpinfo()
1.4.2 Forms
Example creates and processes a form. When the user submits the form, the information typed
into the name field is sent back to this page. The PHP code tests for a name field and displays a
greeting if it finds one.
Processing a form
<html>
<head>
<title>Personalized Hello World</title>
</head>
<body>
<?php if(!empty($_POST[‘name’]))
{
echo “Greetings,{$_POST[‘name’]}, and welcome.”;
}
?>
LOVELY PROFESSIONAL UNIVERSITY 13