New to this forum and looking for some direction

Hi, I’m new here and I’m looking for some help.

I am a graphic designer and am building a website for a client using Dreamweaver CS3. I have built websites before, but am rusty at it, and to top it all off I have agreed to build the client a contact form. I have limited knowledge of PHP, and I am sure that I have gumped up this form with some silly thing, but I don’t know what that would be.

I have created my form with an online tutorial, and the contact form does e-mail me when I’ve submitted it. The problem is it won’t send me any of the data that was put into it.

This is what I get in the body of the e-mail:

First Name:
Last Name:
Phone:
Email:
Address:
City:
State:
Zip:
Summary:

I would really like to use what I have created instead of a FormMailer because I’ve gotten close to success with this. I checked my code in a PHP checker and it says there is no issues. If my problem is not based with PHP, direction to where I can go to solve my website issues would be appreciated.

Do I copy/paste my PHP here or do I attach it? Thank you for your consideration.

Just copy/paste the code into a php block :slight_smile: To get one you just start a new post/message and click the php button in the toolbar

[php]code goes here[/php]

Thank you so much for replying! Here is my code:

[php]<?php

/* Subject and E-mail variables */

$emailSubject = 'Job Inquiry for Get It Done';
$webMaster = '[email protected]';

/* Gathering Data Variables */

$firstnameField = $_POST['A first name'];	
$lastnameField = $_POST['A last name'];
$phoneField = $_POST['A valid phone number'];
$emailField = $_POST['A valid e-mail address'];
$addressField = $_POST['An address'];
$cityField = $_POST['A city'];
$stateField = $_POST['State'];
$zipcodeField = $_POST['A valid zip code'];
$summaryField = $_POST['A brief summary'];

$body = <<<EOD





First Name: $firstname

Last Name: $lastname

Phone: $phone

Email: $email

Address: $address

City: $city

State: $state

Zip: $zipcode

Summary: $summary

EOD;
$headers = "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($webMaster, $emailSubject, $body, $headers);

/* Results rendered as HTML */

$theResults = <<<EOD
Get It Done

Your job inquiry has been sent.

EOD; echo "$theResults";

?>[/php]

I am currently having two problems. One is the e-mail issue, mentioned above. The other is that I don’t get the html page stating the form was sent. If I had to guess, maybe one of the issues are the text fields but I have no clue. Again, I’m very much not fluent in PHP.

[php]$_POST[‘A first name’];[/php] (every $_POST is invalid) what is between the single tick quotes is an invalid. That is one of your bigger problems that pops out at me. An valid expression would be:
[php]$firstnameField = $_POST[‘firstName’];[/php]

Thank you for your reply. Here is my PHP now:

[php]<?php

/* Subject and E-mail variables */

$emailSubject = ‘Job Inquiry for Get It Done’;
$webMaster = ‘[email protected]’;
/* Gathering Data Variables */

$firstnameField = $_POST[‘firstname’];
$lastnameField = $_POST[‘lastname’];
$phoneField = $_POST[‘phone’];
$emailField = $_POST[‘email’];
$addressField = $_POST[‘address’];
$cityField = $_POST[‘city’];
$stateField = $_POST[‘state’];
$zipcodeField = $_POST[‘zipcode’];
$summaryField = $_POST[‘summary’];

$body = <<<EOD




First Name: $firstname

Last Name: $lastname

Phone: $phone

Email: $email

Address: $address

City: $city

State: $state

Zip: $zipcode

Summary: $summary

EOD;

$headers = “From: $email\r\n”;
$headers .= “Content-type: text/html\r\n”;
$success = mail($webMaster, $emailSubject, $body, $headers);
/* Results rendered as HTML */

$theResults = <<<EOD

Get It Done

Your job inquiry has been sent.

EOD; echo "$theResults";

?>[/php]

If the PHP is on top and the html in the EOD, the thank you page will not post. If the html is on the top, it will. I thought that PHP is supposed to be on top though? The e-mail still will not show any data.

I have form validation on my contact form- how do I get it to display a cohesive sentence instead of just “firstname is required.”?

I realized that I needed Field on the end of the EOD:

[php]<?php

/* Subject and E-mail variables */

$emailSubject = ‘Job Inquiry for Get It Done’;
$webMaster = ‘[email protected]’;
/* Gathering Data Variables */

$firstnameField = $_POST[‘firstname’];
$lastnameField = $_POST[‘lastname’];
$phoneField = $_POST[‘phone’];
$emailField = $_POST[‘email’];
$addressField = $_POST[‘address’];
$cityField = $_POST[‘city’];
$stateField = $_POST[‘state’];
$zipcodeField = $_POST[‘zipcode’];
$summaryField = $_POST[‘summary’];

$body = <<<EOD




First Name: $firstnameField

Last Name: $lastnameField

Phone: $phoneField

Email: $emailField

Address: $addressField

City: $cityField

State: $stateField

Zip: $zipcodeField

Summary: $summaryField

EOD;

$headers = “From: $email\r\n”;
$headers .= “Content-type: text/html\r\n”;
$success = mail($webMaster, $emailSubject, $body, $headers);
/* Results rendered as HTML */

$theResults = <<<EOD
/html won’t work if I put it in this area/
EOD;
echo “$theResults”;

?>[/php]

But it still does the same thing. It e-mails me with no information on it. Any help would be very much appreciated!

Sponsor our Newsletter | Privacy Policy | Terms of Service