Since we have already been show the basic principles to creating variables
and how to display them within strictly PHP documents,
it is now time to use these variable within html coding.
However, unless you modify your htaccess file on your
site, all files that contain any PHP coding need to have
Re-Using Your Variables Within HTML
Now you can open a standard HTML layout and leave all
of the <html> tags such as <head><html><body>.
You will be using your PHP tags before, and within,
the HTML layout.
The example below shows how to display [echo] variables
within your web pages. For this example, notice that you
must close and re-open your PHP tags at various points
[this way is more common with pages using PHP, <?php
<?php //create some variables: $total = 30+2; $month = "July"; $day = "17th"; $year = "1981"; ?> <html> <head> <title>Example of PHP in HTML</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head>
<body> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td>The sum of thirty plus two equals: <?php echo $total; ?></td> </tr> </table> <br> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td>The month of my birthday is <?php echo $month; ?><br> The day of my birthday is <?php echo $day; ?><br> The year of my birthday is <?php echo $year; ?></td> </tr> </table>