I have a php contact form. It is not working, I don't know why.
HTML CODE:
<!-- Contact section -->
<section class="contact" id="contact">
<h2 class="heading">Contact <span>Me !</span></h2>
<form action="contact.php">
<div class="input-box">
<input type="text" name="name" placeholder="Full Name">
<input type="email" name="email" placeholder="Email Address">
</div>
<div class="input-box">
<input type="number" name="number" placeholder="Mobile Number">
<input type="text" name="subject" placeholder="Email Subject">
</div>
<textarea name="message" id="" cols="30" rows="10" placeholder="Your Message"></textarea>
<input type="submit" value="Send Message" class="btn">
</form>
</section>
<!-- Contact section end -->`
PHP CODE:
<?php
if(isset($_POST['submit'])){
// Collect form data //
$name = $_POST['name'];
$email = $_POST['email'];
$mobile = $_POST['number'];
$subject = $_POST['subject'];
$message = $_POST['message'];
// My email //
$to = "#mail@mail.com#";
// Set email headers //
$headers = "From: " . $name . " <" . $email . ">\r\n";
$headers .= "Reply-To: " . $email . "\r\n";
// Build email content //
$email_content = "Name: " . $name . "\n";
$email_content .= "Email: " . $email . "\n";
$email_content .= "Mobile Number: " . $number . "\n";
$email_content .= "Subject: " . $subject . "\n";
$email_content .= "Message: " . $message . "\n";
// Send email //
mail($to, $subject, $email_content, $headers);
header("Location: index.html");
}
?>
I try to make own contact form php fail on my webpage.