Page 1 of 1

email form problem

Posted: Tue Mar 18, 2008 9:42 pm
by chapm4
I am sending form data to an email. When I receive the email all I get is:
<br><hr><br>
Notify1: <br>
First Name: <br>
Last Name: <br>
City: <br>
Zip: <br>
Notify2: <br>
Notify3: <br>
Notify4: <br>
Notify5: <br>
Notify6: <br>
Comments: <br>

Instead of seeing the entered data

Here is my php:

Code: Select all

 
<?php
 
/* Subject and Email Information */
 
    $emailSubject = 'OneCallNow Form';
    $webMaster = 'me@me.com';
    
/* Data Variables */
 
    $notify1Field = $_POST['notify1'];
    $firstNameField = $_POST['first_name'];
    $lastNameField = $_POST['last_name'];
    $address1Field = $_POST['address1'];
    $address2Field = $_POST['address2'];
    $cityField = $_POST['city'];
    $zipField = $_POST['zip'];
    $notify2Field = $_POST['notify2'];
    $notify3Field = $_POST['notify3'];
    $notify4Field = $_POST['notify4'];
    $notify5Field = $_POST['notify5'];
    $notify6Field = $_POST['notify6'];
    $commentsField = $_POST['comments'];
    
    $body = <<<EOD
<br><hr><br>
Notify1: $notify1 <br>
First Name: $firstNameField <br>
Last Name: $lastNameField <br>
City: $cityField <br>
Zip: $zipField <br>
Notify2: $notify2Field <br>
Notify3: $notify3Field <br>
Notify4: $notify4Field <br>
Notify5: $notify5Field <br>
Notify6: $notify6Field <br>
Comments: $commentsField <br>
EOD;
 
    $headers = "FROM: $notify1\r\n";
    $headers .= "Content-type: text/html\r\n";
    $success = mail($webMaster, $emailSubject, $body, $headers);
    
/* Results Rendered as HTML */
 
    $theResults = <<<EOD
 
 
EOD;
echo "$theResults";
 
    
 
?>
 
I am quite sure there is something simple here, but I can't find it. Please help

Re: email form problem

Posted: Wed Mar 19, 2008 12:16 am
by wmguk
Hey

straightaway i notice Notify1,
in the variables, you are saying notify1Field ? also can you confirm the data is actually going to the page in the correct variable names, try set the form to get and check the url for the names?
chapm4 wrote:I am sending form data to an email. When I receive the email all I get is:
<br><hr><br>
Notify1: <br>
First Name: <br>
Last Name: <br>
City: <br>
Zip: <br>
Notify2: <br>
Notify3: <br>
Notify4: <br>
Notify5: <br>
Notify6: <br>
Comments: <br>

Instead of seeing the entered data

Here is my php:

Code: Select all

 
<?php
 
/* Subject and Email Information */
 
    $emailSubject = 'OneCallNow Form';
    $webMaster = 'me@me.com';
    
/* Data Variables */
 
    $notify1Field = $_POST['notify1'];
    $firstNameField = $_POST['first_name'];
    $lastNameField = $_POST['last_name'];
    $address1Field = $_POST['address1'];
    $address2Field = $_POST['address2'];
    $cityField = $_POST['city'];
    $zipField = $_POST['zip'];
    $notify2Field = $_POST['notify2'];
    $notify3Field = $_POST['notify3'];
    $notify4Field = $_POST['notify4'];
    $notify5Field = $_POST['notify5'];
    $notify6Field = $_POST['notify6'];
    $commentsField = $_POST['comments'];
    
    $body = <<<EOD
<br><hr><br>
Notify1: $notify1 <br>
First Name: $firstNameField <br>
Last Name: $lastNameField <br>
City: $cityField <br>
Zip: $zipField <br>
Notify2: $notify2Field <br>
Notify3: $notify3Field <br>
Notify4: $notify4Field <br>
Notify5: $notify5Field <br>
Notify6: $notify6Field <br>
Comments: $commentsField <br>
EOD;
 
    $headers = "FROM: $notify1\r\n";
    $headers .= "Content-type: text/html\r\n";
    $success = mail($webMaster, $emailSubject, $body, $headers);
    
/* Results Rendered as HTML */
 
    $theResults = <<<EOD
 
 
EOD;
echo "$theResults";
 
    
 
?>
 
I am quite sure there is something simple here, but I can't find it. Please help

Re: email form problem

Posted: Wed Mar 19, 2008 12:21 am
by wmguk
and you could try this:

Code: Select all

 
$body.="<br><hr><br>";
$body.= "Notify1: $notify1 <br>";
$body.= "First Name: $firstNameField <br>";
$body.= "Last Name: $lastNameField <br>";
$body.= "City: $cityField <br>";
$body.= "Zip: $zipField <br>";
$body.= "Notify2: $notify2Field <br>";
$body.= "Notify3: $notify3Field <br>";
$body.= "Notify4: $notify4Field <br>";
$body.= "Notify5: $notify5Field <br>";
$body.= "Notify6: $notify6Field <br>";
$body.= "Comments: $commentsField <br>";