Hi jozzy,
Came across your post and thought I should contribute my twopence worth.
I have written a little script that should do what you want - a page called fthank.php (which processes your form, sends the email, generates an error if necessary and displays a thank you/confirmation message if the post is successful). So instead of three pages as you stated in your post, you could use two (to be more efficient, you could actually do it all on one page, but lets leave it at this for now).
I have tried to comment the script as much as possible to help you understand the steps. Feel free to post a reply if you do not understand any of the steps.
Here's fback.php (your form) - note that I have amended the "action" in the form tag to point to 'fthank.php'.
<form action="fthank.php" method="post" name="feedback" target="_self" id="form" >
<br>
<div style="position:absolute; text-align: left; left: 31px; top: 23px; font-family: Verdana, Arial, Helvetica, sans-serif; color: #2A7FAA; font-size: 12px; width: 85px; height: 15px; font-weight: 400;">FIRST NAME : </div>
<div style="position:absolute; text-align: left; left: 166px; top: 19px;">
<input type="text" size="30" name="name_first" ></div>
<br>
<div style="position:absolute; left: 30px; top: 51px; width: 87px; text-align: left; font-weight: 400; font-size: 12px; color: #2A7FAA;">LAST NAME:</div>
<div style="position:absolute; text-align: left; left: 166px; top: 47px;">
<input type="text" size="30" name="name_last" ></div>
<br>
<div style="position:absolute; left: 30px; top: 77px; width: 70px; text-align: left; font-weight: 400; font-size: 12px; color: #2A7FAA;">CHAPTER:</div>
<div style="position:absolute; text-align: left; left: 166px; top: 74px;">
<input type="text" size="30" name="_chapter" ></div>
<br>
<div style="position:absolute; text-align: left; left: 30px; top: 107px; font-weight: 400; font-size: 12px; color: #2A7FAA;">ZONE:</div>
<div style="position:absolute; text-align: left; top: 102px; left: 166px;">
<select name="_zone" size="1" >
<option value="n_central">NORTH-CENTRAL</option>
<option value="n_east">NORTH-EAST</option>
<option value="n_west">NORTH-WEST</option>
<option value="s_east">SOUTH-EAST</option>
<option value="s_south">SOUTH-SOUTH</option>
<option value="s_west">SOUTH-WEST</option>
<option value="select" selected>Please select</option>
</select></div>
<br>
<div style="position:absolute; text-align: left; left: 30px; top: 137px; width: 120px; color: #2A7FAA; font-weight: 400; font-size: 12px;">E-MAIL ADDRESS:</div>
<div style="position:absolute; text-align: left; top: 132px; left: 166px;">
<input type="text" name="_e-mail" size="30" ></div>
<br>
<div style="position:absolute; text-align: left; left: 30px; top: 165px; width: 107px; color: #2A7FAA; font-size: 12px; font-weight: 400;">PHONE NO.:</div>
<div style="position:absolute; text-align: left; top: 161px; left: 166px;">
<input type="text" name="_phone" size="30" ></div>
<br>
<br>
<div style="position:absolute; text-align: left; left: 30px; top: 228px; font-size: 12px; font-weight: 400; color: #2A7FAA;">COMMENT:</div>
<div style="position:absolute; text-align: left; left: 166px; top: 216px;">
<textarea name="_comment" cols="35" rows="7" ></textarea></div>
<br>
<br>
<br>
<div style="position:absolute; top: 369px; left: 237px; text-align: left;">
<input type="submit" name="submit" value="SEND MESSAGE" /></div>
</form>
<div id="flash" style="position:absolute; left:158px; top:700px; width:682px; height:80px; z-index:5">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="
http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="675" height="75">
<param name="movie" value="anime/IF%2007.swf">
<param name="quality" value="high">
<embed src="anime/IF%2007.swf" quality="high" pluginspage="
http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="675" height="75"></embed>
</object>
</div>
<div id="footer" style="position:absolute; left:158px; top:800px; width:673px; height:26px; z-index:6" class="text">
<div align="left"><a href="contacts.php" target="_self" onmouseover="window.status='Click to see our contact info'; return true;"
onmouseout="window.status=''; return true;">Contact us</a> | <a href="fback.php" target="_self" onmouseover="window.status='Click to send feedback to us'; return true;" onmouseout="window.status=''; return true;">Feedback</a><br>
© Copyright 2006 - 2007. Bar++ Initiative . All right reserved.</div>
</div>
</div>
</body>
Now here's fthank.php - the processor/confirmation/error page:
<?
//===get the data submitted, store them to variables
$first_name=$_POST['name_first'];
$last_name=$_POST['name_last'];
$chapter=$_POST['_chapter'];
$zone=$_POST['_zone'];
$email=$_POST['_e-mail'];
$phone=$_POST['_phone'];
$comment=$_POST['_comment'];
//===The following message will be sent if post is successful. You can amend this to read whatever you want, just keep your message between the double quotes. '\n' indicates a return, that is going to the next line, so '\n\n' means double-spacing
$message="Hello, a visitor to your site has submitted a message.\n\nThe details are:\n\nFirst name: $first_name\nLast Name: $last_name\nChapter: $chapter\nZone: $zone\nEmail: $email\nPhone: $phone\nComment: $comment\n\n";
//==check that all fields have been completed - if not, prompt user to enter the required data. Note: Do the steps below for each field you want to be required. My example ensures that all fields are required and MUST be filled. If you do not want a field to be required, simply remove that portion, and the script will not validate it. We use a bit of javascript to send user back to form page.
if ($first_name=="") {
echo "<p><center><font color='red'>Please enter your first name</font>";
echo "<p><a href='javascript:history.back(1);'>Back</a>";
}
elseif ($last_name=="") {
echo "<p><center><font color='red'>Please enter your last name</font>";
echo "<p><a href='javascript:history.back(1);'>Back</a>";
}
elseif ($chapter=="") {
echo "<p><center><center><font color='red'>Please enter your chapter</font>";
echo "<p><a href='javascript:history.back(1);'>Back</a>";
}
elseif ($zone=="select") {
echo "<p><center><center><font color='red'>Please select a zone</font>";
echo "<p><a href='javascript:history.back(1);'>Back</a>";
}
elseif ($email=="") {
echo "<p><center><font color='red'>Please enter your email</font>";
echo "<p><a href='javascript:history.back(1);'>Back</a>";
}
//===Also check if a valid email address has been entered i.e an address with invalid characters
elseif (!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/", $email)) {
echo "<p><center><font color='red'>You have entered an invalid email address or none at all </font>";
echo "<p><a href='javascript:history.back(1);'>Back</a>";
}
elseif ($phone=="") {
echo "<p><center><font color='red'>Please enter your phone</font>";
echo "<p><a href='javascript:history.back(1);'>Back</a>";
}
elseif ($comment=="") {
echo "<p><center><font color='red'>Please enter a comment</font>";
echo "<p><a href='javascript:history.back(1);'>Back</a>";
}
//===Now if all validation is successful, send mail. Note the pattern: your email address, the subject of the mail, the actual message - which we declared above, and an address where it is coming from - your choice
else {
mail("
barsplusplus@yahoo.com", "Message Submission", $message, "From:
yoursite@yahoo.com");
//===Having sent the mail, paste a thank you message. You can edit this to read what you want.
echo "<p><center>Thank you for sending a message. Stay well!";
//== you can then offer user a link to any other page on your site, eg your home page
echo "<p><center><a href='index.php'>Back to home page</a>";
}
?>
Any queries, do post a reply.