Page 515 - Computer_Science_F5
P. 515
Computer Science Program Example 8.3:
PHP program to embed PHP code within HTML
<!DOCTYPE html>
FOR ONLINE READING ONLY
<html>
<head>
<title>Dynamic Content</title>
<style>
/* CSS styles */
ul {
list-style-type: none;
padding: 0;
}
li {
padding: 10px;
background-color: #f0f0f0;
margin-bottom: 5px;
}
</style>
</head>
<body>
<h1>Dynamic Content</h1>
<?php include ‘dynamic_content.php’; ?>
</body>
</html>
Step 3: Save the PHP file as `dynamic_content.php` and the HTML file as `index.
php` in the same directory.
Step 4: Open the `index.php` file in a web browser to see the dynamic content
generated by the PHP code embedded within the HTML and styled using
CSS.
506
for Advanced Secondary Schools
Computer Science Form 5.indd 506 23/07/2024 12:35

