View Full Version : E-mail form.


zangerbanger
06-14-2003, 06:26 PM
When I make my e-mail form and click send, I get an error message that says:

Warning: Cannot modify header information - headers already sent by (output started at /home/eternald/public_html/jordan/sendmail.php:8) in /home/eternald/public_html/jordan/sendmail.php on line 9

So how do I fix this? What is header information? Is there something wrong with my code?


<?
$name = $_REQUEST['name'] ;
$ask = $_REQUEST['ask'] ;
$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;

mail( "artemecion@hotmail.com", "This is a message delivered from your website.",
$name, $ask, $message, "From: $email" );
header( "Location: thankyou.php" );
?>

zangerbanger
06-15-2003, 02:26 AM
Geez I was so stupid all along. The variables were supposed to look like this:

$name <$email>

*slams head on table* :lol:

designhazard
06-15-2003, 11:47 AM
<?
$name = $_POST['name'] ;
$ask = $_POST['ask'] ;
$email = $_POST['email'] ;
$message = $_POST['message'] ;
mail( "artemecion@hotmail.com","YOUR MESSAGE SUBJECT","YOUR MESSAGE HERE....","From: $name <$email>" );
header( "Location: thankyou.php" );
?>

make sure mail() function works on your webserver.

Xiphias
06-17-2003, 07:13 PM
*poke poke* Where'd you get that script, zanger?

zangerbanger
06-18-2003, 03:58 AM
Run a google search on "PHP e-mail form script". It should be the third result you find (or something like that!).

designhazard
06-18-2003, 07:14 AM
yeah. it's the third one. does my code work? if not, try this code:

<?
$name = $_POST['name'] ;
$ask = $_POST['ask'] ;
$email = $_POST['email'] ;
$message = $_POST['message'] ;
mail( "artemecion@hotmail.com","YOUR MESSAGE SUBJECT","YOUR MESSAGE HERE....","From: $name <$email>" );
header( "Location: thankyou.php" );
exit;
?>

zangerbanger
06-20-2003, 08:13 PM
Yep, your code works perfectly fine. I got this form up and running a long time ago :) .