Hi, I am trying to create a self referencing contact form in wordpress but I can't work out what to put in the post->action bit. I have tried everything I can think of like
<form action="<?php bloginfo('url')?>/contact-php
and things but everything comes back to page net found, what am I missing?
Are you sure the page exists? Also, you need to have permalinks set up and working, cause this is a permalink you're referring to. The way you do it now, the output would be: http://example.com/contact-php
But if you don't have permalinks set up, it won't work. Check whether or not they are set up and see if this page really exists. Otherwise, try referencing it to some page you do know exists for sure, and add the extension to it, like this: http://example.com/about.php Or like <?php bloginfo('url')?>/about.php
Can you please post your full code of the form? There might an error in your code, as I've just tried it with the following code, which works just fine:
In the code you submitted in your first post, there is no " at the end, maybe thats why it doesn't work? Anyway, like I said, post your full code so we can see whats going on.
I encountered the same issue, and it has to do with the form field names. I believe Wordpress is interpereting either a POST or GET key value of 'name' as a post name to determine what wordpress page to show (resulting in a 404 error in most cases).
To verify if this is the issue, put in the slug of a post (like 'contact-php') in the name field, submit the form and see what happens (If it is a valid page/post slug, it should take you to that page).
http://example.com/contact-php
But if you don't have permalinks set up, it won't work. Check whether or not they are set up and see if this page really exists. Otherwise, try referencing it to some page you do know exists for sure, and add the extension to it, like this:
http://example.com/about.php
Or like <?php bloginfo('url')?>/about.php
Cheers,
Matt
In the code you submitted in your first post, there is no " at the end, maybe thats why it doesn't work? Anyway, like I said, post your full code so we can see whats going on.
Cheers,
Matt
Also, try testing it locally with MAMP or something like that, to see if that works. Might be something with your hosting.
Cheers,
Matt
In case anyone finds this via search...
I encountered the same issue, and it has to do with the form field names. I believe Wordpress is interpereting either a POST or GET key value of 'name' as a post name to determine what wordpress page to show (resulting in a 404 error in most cases).
To verify if this is the issue, put in the slug of a post (like 'contact-php') in the name field, submit the form and see what happens (If it is a valid page/post slug, it should take you to that page).
Laters, Stephen
@sspann Thanks! That was my issue. I should know better than to use common variable names by now.