Any help will be greatly appreciated, I am at a loss here...
I have written a simple PHP registration form for my blog and inserted it in a file called optin.php (see below). I have placed the file in my theme directory and then added an empty page called Registration, using optin.php as a template (so all the content of the Registartion page comes from optin.php).
So far so good, the form displays just fine. However I can't get it to redisplay with the confirmation part after I have submitted the form. I am receiving either a 404 Not Found or "article not found" messages, depending on the value I place in the action= atribute of my form. I have tried about everything...
Here is my optin.php code (simplified for clarity) :
<?php
/**
* @package WordPress
* @subpackage My_Theme
*/
/*
Template Name: Optin
*/
?>
<?php get_header(); ?>
<div id="content" class="widecolumn">
<div class="myClass">
/* some text here */
<?php
if ($_POST['submit'])
{
/* here goes the part to display after form submission */
/* I never managed to redisplay the page to show it... */
}
else
{
print '<form id="contact" method="post" onsubmit="return validateForm()" onreset="clearErrorMessages();" action="">';
/* the rest of the HTML code for the form comes here */
/* this part displays correctly */
print '</form>';
}
?>
</div>
</div>
<?php get_sidebar(); ?>
/* This is the javascript that does form validation with the */
/* onsubmit and onreset functions referenced in <form> above */
<script type="text/javascript" src="http://mysite.com/wp-content/themes/mytheme/script/contactform.js"></script>
<?php get_footer(); ?>
What should the value of action= be for the page to redisplay after the form has been submitted?
The only rewrite rules I have is the standard WP stuff and I only use one .htaccess file (no other rewrite rules elsewhere):
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
I am stuck, please help!