Mixing PHP And HTML In A Web Page

When you are creating a web page that mixes HTML and PHP, which is normally what you need to do, there is more than one way it can be done.

HTML in a PHP page:

1
2
3
4
5
6
7
8
9
10
11
12
< ?php
 
$text="hello World";
 
echo "<table><tr>";
echo "<td>";
 
echo $text;
 
echo "</td>";
echo "</tr>";
?>

PHP in a HTML Page:

1
2
3
4
5
6
7
8
9
10
11
<html>
<body>
< ?php
$text="hello world";
?>
<table><tr>
<td>< ?php echo $text; ?></td>
</tr></table>
 
</body>
</html>

Discussion Area - Leave a Comment




eXTReMe Tracker