I have the following html code for a form;
<form action="email.php" method ="POST" >
<label>Name</label><br>
<input type="text" value="" class="form" name ="name"><br>
<label>Email</label><br>
<input type="text" value="" class="form" name ="email"><br>
<label>Message</label><br>
<textarea rows ="3" class ="form" name ="message"></textarea>
<label></label><br>
<input type="submit" value="submit">
</form>
the form has the action of a file called email.php-this file is meant to send the users details to an email address using the mail function. It contains the following;
<html>
<body>
Thankyou <?php echo $_POST["name"]. ","; ?> <br>
<?php echo $_POST["email"]; ?> Will be contacted soon.
<?php
$to = "
[email protected]";
$name = $_POST["name"];
$email =$_POST["email"];
$message = $_POST["message"];
$subject="Web Design";
$headers = 'From:'. $email . "\r\n" .
'Reply-To:'. $name . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers)
header("Location: index.html")?>
</body>
</html>
I have tried the code with a working email address however none of it seems to work- what happens is when the submit button is clicked the user is redirected a plain white page ("/email.php"). Looking for help urgently. Kind Regards, R.