My PHP Code cannot submit my online webform.
I cannot submit my contact form using my PHP code, along with my HTML form to my email when I execute this code? All I get is the "echo" of "there is an error" when submitting the form
Everything has been uploaded onto my Azure Remote Server and both documents below are in the root director
To be honest, my patience is running very thin with this. I'm so sick to death of ripping my hair out trying to work out why this is deciding to act like a disobedient child and now like a piece of software. Nothing I do ever works and I'm about to throw this computer against the wall. So save a computer from getting destroyed.
Thanks
<form action="/handler_mail.php" method="post">
<div class="formHeader textBlock">Book a casting</div>
<div class="formCaption textBlock">Please use this form to book a casting with me. </div>
<hr>
<label for="firstName">Firstname</label>
<input class="formInput" type="text" name="firstName" placeholder="First Name"/><br>
<label for="surname">Surname</label>
<input class="formInput" type="text" name="surname" placeholder="Surnames"/><br>
<label for="yourEmail">Your Email</label>
<input class="formInput" type="email" name="yourEmail" placeholder="Email address"/><br>
<br>
<textarea class="formInput" style="width: 500px; height: 300px;" placeholder="Please specify the particulars">
</textarea><br>
</form>
<?php
if(isset($_POST{"formSubmit"})){
$name=$_POST["firstName"];
$surname=$_POST["surname"];
$email=$_POST["yourEmail"];
$to ="example@example.com";
$subject="Form Submission";
$message="Name: ".$name."\n"."Surname: ".$surname;
$headers="From: ".$email;
if(mail($to, $name, $surname, $email)){
echo "Success" . " -" . "<a href='Pages/bookacasting.html' style='text-decoration:none;color:#ff0099;'> Return Home</a>";
}
else{
echo "Error" . " -" . "<a href='Pages/bookacasting.html' style='text-decoration:none;color:#ff0099;'> Return Home</a>";
}
}
?>
