PHP Conact Email Form Help?

  • Thread starter Thread starter Omnipotent
  • Start date Start date
O

Omnipotent

Guest
I have a php form ( halochiefs.net/contact/ ) and it works, but it only sends what they type in textfield4. I have the code, but how do I make it send every field?

My Code:
<?php
// Declare Variables
// Collect post data
$to = '[email protected]';
$subject = 'Halo Chiefs Contact Form';
$from = $_POST['[email protected]'];
$message = $_post['textfield4']

// Set up the headers
$headers = 'From: [email protected]' . "\r\n" .
'Reply-To: [email protected]' . "\r\n";

$mail = mail($to, $subject, $message, $headers);

if($mail) {
echo 'Mail sent! Please press 'back,' to continue.';
header( "Location: http://www.halochiefs.net/contact" );
} else {
echo 'An error occured! Refresh the page and try again.';
}
?>

Help!
 
$message = $_POST['textfield4'] . $_POST['textfield5'] . $_POST['textfield6'];

something like that. Note that the above code will put all the entires together. Maybe put a space in between, or a "\r\n".

also note that the "mail sent!" will never get displayed in your above code since the header(location:) will take the user to the new page straight away.
 
Back
Top