i have this code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Haircut Appointment</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 20px;
background-color: #f4f4f9;
color: #333;
}
.appointment-form {
max-width: 400px;
margin: 0 auto;
padding: 20px;
background: #fff;
border-radius: 8px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
.appointment-form h2 {
text-align: center;
margin-bottom: 20px;
}
.appointment-form label {
display: block;
margin: 10px 0 5px;
font-weight: bold;
}
.appointment-form input, .appointment-form textarea, .appointment-form button {
width: 100%;
padding: 10px;
margin-bottom: 15px;
border: 1px solid #ddd;
border-radius: 5px;
}
.appointment-form button {
background-color: #4CAF50;
color: white;
border: none;
cursor: pointer;
font-size: 16px;
}
.appointment-form button:hover {
background-color: #45a049;
}
</style>
</head>
<body>
<div class="appointment-form">
<h2>Book a Haircut Appointment</h2>
<form action="appointment-handler.php" method="post">
<label for="name">Full Name</label>
<input type="text" id="name" name="name" required>
<label for="email">Email Address</label>
<input type="email" id="email" name="email" required>
<label for="phone">Phone Number</label>
<input type="tel" id="phone" name="phone" required>
<label for="date">Preferred Date</label>
<input type="date" id="date" name="date" required>
<label for="time">Preferred Time</label>
<input type="time" id="time" name="time" required>
<label for="message">Additional Notes (Optional)</label>
<textarea id="message" name="message" rows="4"></textarea>
<button type="submit">Book Appointment</button>
</form>
</div>
</body>
</html>
with that php
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// Collect form data
$name = htmlspecialchars($_POST["name"]);
$email = htmlspecialchars($_POST["email"]);
$phone = htmlspecialchars($_POST["phone"]);
$date = htmlspecialchars($_POST["date"]);
$time = htmlspecialchars($_POST["time"]);
$message = htmlspecialchars($_POST["message"]);
// Email details
$to = "[email protected]"; // Your email
$subject = "New Haircut Appointment Request";
$body = "You have received a new appointment request:\n\n"
. "Name: $name\n"
. "Email: $email\n"
. "Phone: $phone\n"
. "Preferred Date: $date\n"
. "Preferred Time: $time\n"
. "Message: $message\n";
$headers = "From: [email protected]\r\n" . // Replace with your domain email
"Reply-To: $email\r\n";
// Send email
if (mail($to, $subject, $body, $headers)) {
echo "<h2>Thank you, $name! Your appointment request has been sent.</h2>";
} else {
echo "<h2>Sorry, there was an error sending your request. Please try again.</h2>";
}
} else {
echo "<h2>Invalid request method.</h2>";
}
?>
all is ready but i cant get amy mail !!! ANY HELP !!! i have the free plan of hosting and with the free domain