• Explanation: Learn how to create a contact form that sends data to an email address.
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$name = $_POST["name"];
$email = $_POST["email"];
$message = $_POST["message"];

mail("admin@example.com", "Contact Form Submission", $message, "From: $email");
}
?>
<form method="POST">
<input type="text" name="name" placeholder="Your Name" required>
<input type="email" name="email" placeholder="Your Email" required>
<textarea name="message" placeholder="Your Message" required></textarea>
<button type="submit">Send</button>
</form>
• Logic: This form captures user data and sends it to the admin's email using PHP mail() function