Web Application with PHP


PHP embedded in HTML

<html>
<head><title>Example 1</title></head>
<body>
<?php
/* If it is April 1st, we show a quote */
if (date('md' == '0401')) {
echo 'A bookstore is one of the only pieces of evidence we have '.
'that people are still thinking. <i>Jerry Seinfeld</i>';
} else {
echo 'Good morning!';
}
?>
</body>
</html>

The line
<?php
begins the PHP section embedded into the HTML code; the
line
?>
ends the PHP section. Notice that the code uses echo
to send the output.
When the text is so simple, the echo
statements are acceptable.