Php Script working only 50%

  Lashed 21:01 04 Mar 2008

i have a problem with a web form i created by watching a tuturial vid from click here

My web form works to some extent, if i fill out the form on my website click here in my inbox i recive an email but all i have is the field names but not what the user has wrote (Me for practice runs) here is my script:


/* Subject and email variables */

$emailSubject = 'Lawrence Services!';
$webMaster = '[email protected]';

/* Gathering Data Variables */

$namefield = $_POST['name'];
$streetAddressfield = $_POST['address'];
$emailfield = $_POST['email'];
$phonefield = $_POST['phone'];
$faxfield = $_POST['fax'];
$enquiryfield = $_POST['enquiry'];

$body = EOD
br> hr> br>
Name: $name br>
Street Address: $address br>
Email: $email br>
Phone Number: $phone br>
Fax Number: $fax br>
Enquiry: $enquiry br>

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

/*Results rendered as html*/

$theResults = EOD
title>Thankyou /title>
meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

p align="center"> a href="click here"> img src="images/logo.gif" width="391" height="175" border="0"> /a> /p>
p align="center">  /p>
p align="center"> font size="+1" face="Arial">Thankyou, your enquire will be
seen to and replied to as soon as possible! /font> /p>
echo "$theResults";

if someone knows anything about PHP as i don't then it would be very helpful. Thanks in advance!

click here

  Lashed 21:04 04 Mar 2008

just seeing my post the "<" key is not showing up here when i copied and pasted my php file, but i have used them in my script "<" where there needed.

  MAJ 22:06 04 Mar 2008

I realise you might want to do it yourself, Lashed, but have you tried looking at the script here. click here It might point you in the right direction, if Kemistri (our resident PHP expert) doesn't arrive in the meantime.

  ElanMan 22:15 04 Mar 2008

Hi Lashed,
When you assign the $body variable you are passing it variables that do not exist.
For example, 'Email: $email' should be
'Email: $emailfield' as has been specified earlier in the code.
I hope that makes sense!

  Kemistri 02:00 05 Mar 2008

I usually recommend this: click here, but with the markup removed (I strongly recommend keeping the PHP separated from the markup) and a few other tweaks. Have a play around with that.

  CodeMeister 15:32 05 Mar 2008


I would quickly edit your post and remove that email address unless you particularly like to receive spam.

  Kemistri 15:39 05 Mar 2008

There's no edit function here!

  Lashed 16:59 05 Mar 2008

Can't an admin edit my post?? or something?

  Kemistri 17:09 05 Mar 2008

The FE could delete it, but because it's the opening post, that would entail deleting the whole thread -- the remainder wouldn't make any sense otherwise. I don't think that the FE can modify posts, but you can ask him.

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

WPA2 Hack Latest News: How Secure is your Wi-Fi?

Photoshop CC 2018 released with new Curvature Pen and better brush tools

Best kids apps for iPhone & iPad

Comment utiliser Twitter ?