I have a custom form in one of my wordpress pages(this page uses a custom template)-
<form action="www.mysite.com/custom-page-2" method="post">
.
.
.
</form>
Now the problem is that on submitting the browser shows the url "www.mysite.com/custom-page-2" in the address bar but shows a 404 page not found error. I read other solutions which ask to use action attribute for the same form page or use ajax or jquery. But my question is that why cant we use this method like normal php. What am I missing?
-
1I think you forgot the "http://". The url must be "mysite.com/custom-page-2".llullulluis– llullulluis2011年09月27日 16:56:00 +00:00Commented Sep 27, 2011 at 16:56
2 Answers 2
Try changing the action to: http://www.mysite.com/custom-page-2
UPDATE
After a little bit of digging it seems you need to set your action to an empty string, and redirect to the page you want during the form submission handler.
Try following steps 1 - 3 of this answer but instead of redirecting back to the same page, redirect to the page you want to go to.
Hope that helps
3 Comments
The problem is if you use general values for your "name" attribute it surprisingly fails(example- name="name")...just prefix it with some unique name...maybe wordpress uses these names itself and causes clashes..