The header info you get is because there was output prior to the "headers" manipulation (be it a session, cookie or anything else that uses the headers).
The resolution is fairly simple... change the php block to the top of the page...
The culprit is the line:
header ("Location:$thankyouURL");
Another thing that is worth something... if your smtp server works ok (some don't work 100%), the mail function returns a true value when the mail is sent correctly and a false when it can't send the mail...
You can redirect to diferent pages acording to it and in case of failure, ask for another kind of contact...
Cheers, Luis Ferro
Patrick Roane wrote:
Thanks for the quick response. I tried your suggestion
and I do get an e-mail sent from the form when I test
it. The problem is, I only receive the date the form
was filled out minus any of the values. I also get the
error msg:
Warning: Cannot add header information - headers already sent by ...
I looked this up and added:
<?php ob_start(); // file content ob_end_flush(); ?> to my script, but I still get the error.
--- "lferro@xxxxxxxxxxxxxxx" <lferro@xxxxxxxxxxxxxxx> wrote:
Hi there,
First, prolly, your file needs to be called
chair1.php instead of chair.html...
Second, you should add something in the lines of:
if (isset($_POST["submit"])) {
.... email sending code here...
}
If not, the users, when they reach the page will
send an empty form to the email...
Cheers, Luis Ferro
Patrick Roane wrote:
I am trying to include form-parsing code on thesame
"http://www/w3/org/TR/xhtml1/DTD/xhtml1-strict.dtd">page as my hard-coded HTML form- but I'm doing something wrong. The name of my file is chair1.html
Please see below:
thanks!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict/EN"
<html>media="screen"
<head>
<title>form</title>
<link rel="stylesheet" type="text/css"
class="rightsidebar"><tr><td>   </td>href="center.css"> <style type="text/css">
</style> </head> <body bgcolor="#999900"> <table border="0" cellpadding="5" width="100%" bgcolor="#999900" class="rightsidebar"><tr> <td> </td> <td align="center"><div id="whitetitle">Item Ch1-1</div></td> <td>  </td>
<body bgcolor="#999900">
<table border="0" cellpadding="0" width="100%"
align="left" bgcolor="#999900"
want<td> </td>
<td><img src="chair_pics/rt_chair.jpg" alt="" height="304" width="160" border="0" align="right"></td> <td> </td> <td align="left"><ul>
<li>» Arm Chair</li> <li>» Beach wood</li>
<li>» Height: 42"</li> <li>» Seat: 19"w x 18 1/2d</li>
<td> </td> <td> </td> <td> </td>
</ul> </td> </tr>
</table> <table border="0" cellpadding="0" width="100%" align="left" bgcolor="#999900"><tr><td>
<?php $to = "fojomo@xxxxxxxxx"; //Change to the email you
want the form results to be sent to
$subject = "Form Results"; //Change to what you
"http://www.crost.com/test/index.html";the title of the email to be
$headers = "From: Form Mailer";
$thankyouURL =
//Change to the url you want the form to go toafter
$_SERVER['PHP_SELF']submit
$date = date ("l, F jS, Y"); $time = date ("h:i A");
$msg = "Submitted on $date at $time.\n\n";
if ($_SERVER['REQUEST_METHOD'] == "POST") {
foreach ($_POST as $key => $value) { $msg .= ucfirst ($key) ." : ". $value . "\n"; }
} else {
foreach ($_GET as $key => $value) { $msg .= ucfirst ($key) ." : ". $value . "\n"; }
}
mail($to, $subject, $msg, $headers); header ("Location:$thankyouURL");
?>
<fieldset><legend align="center">Questions & Comments</legend><br>
<form method="post" action="{' .
you need, is in your soul. You can do this if you. '}"> <input type="checkbox" name="Ch1-1[]" value="Ch1-1" />I'd like to purchase Item Ch1-1: <input type="checkbox" name="similar_1[]" value="similar_1" />Do you have something similar? <input type="checkbox" name="browse_1[]" value="browse_1" />Just browsing: <p>Name:<br /> <input type="text" name="user" /></p> <p>Phone:<br /> <input type="text" name="phone" /></p><br /> Comments:<br /> <textarea name="Comments" rows="5" cols="40"></textarea></fieldset>
<p><input type="submit" value="submit data" /></p> </form> </tr> </td> </table> </body> </html>
=====
----------------
"forget your lust for the rich man's gold. All that
try. All that I want for you my son, is to be
satisfied"
~ Lynard Skynard
-- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
=====
---------------- "forget your lust for the rich man's gold. All that you need, is in your soul. You can do this if you try. All that I want for you my son, is to be satisfied"
~ Lynard Skynard
-- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php