posting form to custom template results in 404
-
Hi all,
I have a very strange problem, and I hope someone can help me out.
I have created a very basic custom template, that contains a form, that is submtted back to the template.
If I enter any data into the form fields then I get a 404 error back from wordpress.
If I leave the form fields empty wordpress acepts the form (even if their are hidden fields).
You can see for yourself here:
https://blossombeinspired.com/test/
submit the form without data and you’ll get a ‘form submitted okay message’, add anything to in the form field and it returns a 404.
ANY help whatsoever appreciated, I have been trying to sort this for hours.
PS form works fine when not part of wordpress, I have also tried other versions of wordpress (2.0), and also tried 2 different servers and the same thing happens.
This is the code:
if ($_SERVER[‘REQUEST_METHOD’] == GET){
?>
<form action=”<?php echo $_SERVER[‘REQUEST_URI’]; ?>” method=”POST”>Name: <input type=”text” name=”name” value=””>
<input type=”hidden” name=”foo” value=”bar”><input type=”submit” value=”Submit”>
</form>
<?php
}
else if ($_SERVER[‘REQUEST_METHOD’] == POST){
echo “form submitted okay”;
}
- The topic ‘posting form to custom template results in 404’ is closed to new replies.