<!DOCTYPE html>
<html>
<head>
<title>My Business Website</title>
</head>
<body>
<?php
// Define variables for website content
$companyName = "My Business";
$tagline = "We offer the best services";
$navLinks = array("Home", "About Us", "Services", "Contact Us");
// Define function to generate navigation links
function generateNavLinks($navLinks) {
// Loop through nav links array and generate links
foreach ($navLinks as $link) {
echo "<a href='#'>$link</a> ";
}
}
?>
<header>
<h1><?php echo $companyName; ?></h1>
<p><?php echo $tagline; ?></p>
</header>
<nav>
<?php generateNavLinks($navLinks); ?>
</nav>
<main>
<section>
<h2>About Us</h2>
<p>We are a company that offers the best services in the industry.</p>
</section>
<section>
<h2>Services</h2>
<ul>
<li>Service 1</li>
<li>Service 2</li>
<li>Service 3</li>
</ul>
</section>
<section>
<h2>Contact Us</h2>
<form action="submit-form.php" method="POST">
<label>Name:</label>
<input type="text" name="name" required>
<label>Email:</label>
<input type="email" name="email" required>
<label>Message:</label>
<textarea name="message" required></textarea>
<input type="submit" value="Submit">
</form>
</section>
</main>
<footer>
<p>© <?php echo date('Y'); ?> <?php echo $companyName; ?></p>
</footer>
</body>
</html>
This code defines variables for the website content, such as the company name, tagline, and navigation links. It also defines a function to generate the navigation links, and uses it to display the links in the navigation section.
The code also includes sections for the About Us, Services, and Contact Us pages, and uses a simple form to allow visitors to submit a message to the business.
Finally, the code includes a footer section that displays the current year and the company name.
0 Comments