PHP webform trouble

Hi there,

Can anyone help me, I’m sure I’ve just missed something but I can’t for the life of me see what it is.

I’ve attempted to do a webform with Dreamweaver and it all works fine apart from when I send an email to test it, it comes through without who it is from and none of the text that has been filled in from the text fields.

Here is the php if that’s the problem.

[php]<?php

/* Subject and Email Variables */

$emailSubject = 'TEST1';
$webMaster = '[email protected]';

/* Gathering Data Variables */

$nameField = $_POST['name'];
$addressField = $_POST['address'];
$emailField = $_POST['email'];
$vouchernumberField = $_POST['vouchernumber'];
$colourField = $_POST['colour'];
$colourchoicetwoField = $_POST['colourchoicetwo'];
$sizeField = $_POST['size'];

$body = <<<EOD





Name: $name

Address: $address

Email: $email

Voucher Number: $vouchernumber

Colour: $colour

Colour Choice Two: $colourchoicetwo

Size: $size

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
voucher1
Thank you for your email!
EOD; echo "$theResults";

?>[/php]

I hope you can help.

Kind regards

Aaron

Hello Aaron Roberts, i have checked your code and found that you are using wrong variable. please replace $body with below code

[php]
// use below code for $body
$body = <<<EOD




Name: $nameField

Address: $addressField

Email: $emailField

Voucher Number: $vouchernumberField

Colour: $colourField

Colour Choice Two: $colourchoicetwoField

Size: $sizeField

EOD;

// Also replace
$headers = “From: $email\r\n”;
//with below code
$headers = “From: $emailField\r\n”;
[/php]

i hope this will helpful for you…
Reply your feedback
SR

Sponsor our Newsletter | Privacy Policy | Terms of Service