So I'm building a site on the WP platform and have never come across this before, hoping someone might be able to help me out.
I have a form, that when submitted is redirected to a sent / thank you page. I'm using the wp home_url
function for the redirect. When I press submit, I'm getting a 404, but the url it's redirecting to is correct and there is a page published with that permalink.
To make it weirder, if I erase the permalink in the URL bar of my browser and retype it, exactly the same, it then finds the page no problem.
Here's the form:
<form action="<?php echo home_url('/'); ?>sent/" method="POST" class="col-md-7">
<input id="name" placeholder="name:" name="name" type="text" class="form-control" required></label>
<input id="email" placeholder="email:" name="email" type="text" class="form-control" required>
<textarea id="message" placeholder="message:" name="message" class="form-control" rows="8" required></textarea>
<button id="contact-submit" type="submit" class="btn form-control">Submit</button>
</form>
- NB I've tried using the actual URL instead of the wp
home_url
function as well, to no avail.
Just in case, here's the post commands too:
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$formcontent="From: $name, $email, \nMessage: $message";
$recipient = "email@email.com";
$subject = "Contact Form Submission";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
As always, thanks in advance for any help / insight!