I'm customizing the "info/contact.php" file.
I want replace the the sample contact form, with my own contact form.
When the user clicks on the submit button, an email should be sent with the form details.
This is the form code:
<div class="info-form">
<form action="" method="post">
<div class="name">
<label>Enter your name..</label><br>
<input type="text" name="name" required>
</div>
<div class="email">
<label>Enter your email..</label><br>
<input type="email" id="email" name="email"required>
</div>
<div class="yourmessage">
<label>Briefly describe your topic</label><br>
<input type="text" name="ymessage" required>
</div>
<input type="submit" name="submit" value="Submit">
</form>
</div>
And, on the same page, I have inserted a Php script that sends the email, using the mail function:
<?php
if (!empty($_POST["email"])) {
$to = "myemail@gmail.com";
$subject = 'contact form';
$from = "admin@theilmtech.com";
$fromName = "Junaid Khan";
unset($headers);
$headers = "From: $fromName"." <".$from.">";
$msg = "Mail: ".$_POST["email"];
//Need to modify Header
$mail = @mail($to, $subject, $msg, $headers);
header("Location: info/contact.php");
}
?>
When I click on the submit button, I get a 403 Forbidden error.
What can I do to solve this ?