Shh...

Technical Archives

September 27, 2009

Posting A Form to A WordPress Page

I develop quite a few sites in WordPress. Being that many of these sites are not “blogs” and need to behave like a traditional, static website, I’ve come across and worked through several obscure and (understandably) poorly documented issues and quirks in WordPress.

This is one of those stories.

I had a page template with a simple contact form that was posting to # (itself):

<form name="contactform" method="post" action="#">
   <input name="name" />
   <input name="email" />
   <input name="phone" />
   <textarea name="comment"></textarea>
   <input type="submit"  name="submit" />
</form>

Looked great, but when I submitted the form, instead of reloading the page with the form posted, WordPress would display the 404 error page. Looking at the address bar, the URL was identical (except with a # at the end), and if I reloaded the page without reposting the form data, the unsubmitted page would load fine. I was both baffled and maddened.
Continue Reading »

23 Posted in Technical | | | | | |