Show Contacts (contact.php) Code Example

Copy the code below:

<!DOCTYPE html>
<html lang="en">
<?php 
  $pageTitle = "Contact Us"; 
  include 'includes/head.php';  
?> 
       
<body>
 <?php include 'includes/navbar.php'; ?>

<div class="container mt-5">
	<h2 class="mb-4">
		Contact Us
		<i class="bi bi-mailbox2"></i>
	</h2>
	
<?php
if (isset($_GET['success']) && $_GET['success'] == 1) {
    echo "<p class='message'>Your message has been sent successfully!</p>";
}
?>
<!--Updated form using Bootstrap-->
<form action="process_contact.php" method="POST" class="mt-4" style="max-width: 300px; padding-left: 10px; padding-bottom: 10px;">

  <div class="form-floating mb-3 mt-3">
    <input type="text" name="first_name" id="first_name" class="form-control" required>
    <label for="first_name" class="form-label">First Name</label>
  </div>

  <div class="form-floating mb-3 mt-3">
    <input type="text" name="last_name" id="last_name" class="form-control" required>
    <label for="last_name" class="form-label">Last Name</label> 
 </div>

  <div class="form-floating mb-3 mt-3">
    <input type="email" name="email" id="email" class="form-control" required>
    <label for="email" class="form-label">Email</label> 
  </div>

  <div class="form-floating mb-3 mt-3">
    <input type="text" name="subject" id="subject" class="form-control" required>
    <label for="subject" class="form-label">Subject</label>
  </div>

  <div class="form-floating mb-3 mt-3">
    <textarea name="message" id="message" rows="5" class="form-control" required></textarea>
    <label for="message" class="form-label">Message</label>
  </div>

  <button type="submit" class="btn btn-primary">Send Message</button>

</form>

</div>
 <?php include 'includes/scripts.php'; ?>
</body>
</html>