PHP Form not sending data through

Hey, Everybody. Thank you so much for taking the time to look at my code. I really appreciate any help you are able to give me.

I have a contact form that is not passing the information entered through to the email address. I AM getting emails when the contact form “submit” button is pressed, but I am NOT getting the name, email address, etc that has been entered into the form. Does that make sense?

I used a tutorial to create this form as I do not know much about PHP. It must be a minor syntax error of some kind. Any ideas?

Thank you again!

Scott

Here is the PHP form code:

<?php /* Subject and Email Variables */ $emailSubject = 'Scott Allen Resume Web Inquiry'; $webMaster = '[email protected]'; /* Gathering Data Variables */ $first_nameField = $_POST['first_name']; $last_nameField = $_POST['last_name']; $email_fromField = $_POST['email_from']; $telephoneField = $_POST['telephone']; $commentsField = $_POST['comments']; $body = <<<EOD


First Name: $first_name
Last Name: $last_name
Email: $email_from
Phone: $telephone
Comments: $comments
EOD; $headers = "From: $email_from\r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail($webMaster, $emailSubject, $body, $headers); /* Results Rendered as HTML */ $theResults = <<<EOD Resume of Scott S Allen, Search Engine Optimizer and Search Engine Marketer

Online Resume of Scott Allen

Seeking to make a difference in the world through my knowledge of Search Engine Marketing and Optimization.



Thank you for taking the time to contact me.
I sincerely hope that you have found my Web site useful.
I will be getting back with you shortly. Thank you again.







© 2011 Scott Allen. All rights reserved.

EOD; echo "$theResults"; ?>

Your variable names are different than those used in the email body:

[php] $first_nameField = $_POST[‘first_name’];
$last_nameField = $_POST[‘last_name’];
$email_fromField = $_POST[‘email_from’];
$telephoneField = $_POST[‘telephone’];
$commentsField = $_POST[‘comments’];[/php]

[php]First Name: $first_name

Last Name: $last_name

Email: $email_from

Phone: $telephone

Comments: $comments
[/php]

(They’re called $itemField yet used as $item). Also, in future, please place your code into code or php tags (as shown in the IMPORTANT message above the text field used to make a thread or reply to one).

Sponsor our Newsletter | Privacy Policy | Terms of Service