<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Cabeeb &#187; Technical</title>
	<atom:link href="http://www.cabeeb.com/category/technical/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.cabeeb.com</link>
	<description>Caleb White&#039;s Personal Blog of Mystery &#38; Enchantment</description>
	<lastBuildDate>Mon, 14 Feb 2011 09:53:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>Posting A Form to A WordPress Page</title>
		<link>http://www.cabeeb.com/feeder/?FeederAction=clicked&#038;feed=Articles+%28RSS2%29&#038;seed=http%3A%2F%2Fwww.cabeeb.com%2F2009%2F09%2Fposting-a-form-to-a-wordpress-page%2F&#038;seed_title=Posting+A+Form+to+A+WordPress+Page</link>
		<comments>http://www.cabeeb.com/feeder/?FeederAction=clicked&#038;feed=Articles+%28RSS2%29&#038;seed=http%3A%2F%2Fwww.cabeeb.com%2F2009%2F09%2Fposting-a-form-to-a-wordpress-page%2F&#038;seed_title=Posting+A+Form+to+A+WordPress+Page#comments</comments>
		<pubDate>Sun, 27 Sep 2009 17:38:16 +0000</pubDate>
		<dc:creator>Cabeeb</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[Errors]]></category>
		<category><![CDATA[HTML Forms]]></category>
		<category><![CDATA[POST Variables]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Wordpress Development]]></category>
		<category><![CDATA[Wordpress Forms]]></category>

		<guid isPermaLink="false">http://www.cabeeb.com/?p=1146</guid>
		<description><![CDATA[<p>I develop quite a few sites in WordPress. Being that many of these sites are not &#8220;blogs&#8221; and need to behave like a traditional, static website, I&#8217;ve come across and worked through...</p>]]></description>
			<content:encoded><![CDATA[<p>I develop quite a few sites in WordPress. Being that many of these sites are not &#8220;blogs&#8221; and need to behave like a traditional, static website, I&#8217;ve come across and worked through several obscure and (understandably) poorly documented issues and quirks in WordPress.</p>
<p>This is one of those stories.</p>
<p>I had a page template with a simple contact form that was posting to # (itself):</p>
<pre class="brush: xhtml">
&lt;form name=&quot;contactform&quot; method=&quot;post&quot; action=&quot;#&quot;&gt;
   &lt;input name=&quot;name&quot; /&gt;
   &lt;input name=&quot;email&quot; /&gt;
   &lt;input name=&quot;phone&quot; /&gt;
   &lt;textarea name=&quot;comment&quot;&gt;&lt;/textarea&gt;
   &lt;input type=&quot;submit&quot;  name=&quot;submit&quot; /&gt;
&lt;/form&gt;
</pre>
<p>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.<br />
<span id="more-1146"></span><br />
As a last, desperate resort, I decided to change the names of the form fields, after which it worked perfectly. Being that I&#8217;d worked on that issue for an hour, it was a frustrating relief.</p>
<p>I didn&#8217;t know this at the time, but WordPress uses POST variables (the same kind that you pass when you submit a form) in the secret hocus pocus that goes on in the background as a page loads. And my POST variables were conflicting with them.</p>
<p>So, I just added &#8220;form&#8221; in front of all the field names, and it was golden:</p>
<pre class="brush: xhtml">
&lt;form name=&quot;contactform&quot; method=&quot;post&quot; action=&quot;#&quot;&gt;
   &lt;input name=&quot;formname&quot; /&gt;
   &lt;input name=&quot;formemail&quot; /&gt;
   &lt;input name=&quot;formphone&quot; /&gt;
   &lt;textarea name=&quot;formcomment&quot;&gt;&lt;/textarea&gt;
   &lt;input type=&quot;submit&quot; name=&quot;submit&quot; /&gt;
&lt;/form&gt;
</pre>
<p>So the moral of the story is this:<br />
If you are posting a custom form anywhere within WordPress, use very unique field names so that they don&#8217;t conflict with WordPress&#8217; variables.  Otherwise, when you submit the form, it will have errors displaying the page, and instead display the 404 error page.</p>
<p>I think I just saved you an hour.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cabeeb.com/feeder/?FeederAction=clicked&#038;feed=Articles+%28RSS2%29&#038;seed=http%3A%2F%2Fwww.cabeeb.com%2F2009%2F09%2Fposting-a-form-to-a-wordpress-page%2F&#038;seed_title=Posting+A+Form+to+A+WordPress+Page/feed/</wfw:commentRss>
		<slash:comments>58</slash:comments>
		</item>
	</channel>
</rss>

