Contact form text

Hi All,

I’m just trying to finish off a contact from and have got stuck on one element. In the body of the text that is sent to the person I would like there name mentioned at a particular point ( highlighted in bold below - What do i put here?). Could some one let me know the code that would need to be added? Let me know if additional information is required.

Many thanks,


$from = $_REQUEST[‘Email’] ;
$company = $_REQUEST[‘Company’] ;
$name = $_REQUEST[‘Name’] ;
$headers = “From: $from”;
$subject = “Web Contact Data”;

$fields = array();
$fields{“Name”} = “Name”;
$fields{“Company”} = “Company”;
$fields{“Email”} = “Email”;
$to = “”;

$body = "We have received the following information:

“; foreach($fields as $a => $b){ $body .= sprintf(”%20s: %s
",$b,$_REQUEST[$a]); }

$headers2 = “From:”;
$subject2 = “text”;
$autoreply = "
Thank you for registering with the xxxxxxxxxxxx. Please use your unique reference code attached below when making your booking.

your name: (What do i put here?)
Password: direct**

This e-mail is confidential and intended for the addressee (s) only. It may also be privileged. If you are not the intended recipient, please notify the sender by replying to this e-mail. You should not copy this e-mail or otherwise use it for any purpose and the contents must not be disclosed to any other person.";

if($from == ‘’) {echo “You have not entered an email, please go back and try again”;}
else {
if($name == ‘’) {echo “You have not entered a name, please go back and try again”;}
else {
$send = mail($to, $subject, $body, $headers);
$send2 = mail($from, $subject2, $autoreply, $headers2);
{header( “Location:” );}
{echo “We encountered an error sending your mail, please notify”; }
$headers = "\r
$recipients = “,”;
mail($recipients, “This is the subject”,“This is the mail body”, $headers);

How about

$autoreply = "Thank you for registering ... 
Your name:" .  $name .
"Password: direct ... ";

Hi Ralph

Thanks for your reply. I’ve tried adding the code and get a syntax error? I would not want to change any of the other elements of the form.

Am i right in thinking that all of the body text that would appear in the email sits inside the " and "; If so the additional "; would effect the information after? Though I don’t really any experience of php so kind of have no idea of what i’m talking about :confused:

your name: (What do i put here?)
Password: direct

You use string concatenation (a dot .) to join the array field ‘Name’ (watch the case) into the string you already have:

your name: " . $fields['Name'] . "
Password: direct

Like you would in Javascript, but that uses a + sign to join bits of a string together.

Thanks for the reply. All seems to work now, so am very happy.