Mail Script Problems
Posted on
16th Feb 2014 07:03 pm by
admin
I have created a PHP mail script. I am having a problem though. In $body i am trying to put two values side by side like so $Fname $Lname. Where ever i use
tag the values appear in the final message but where i place the values side by side without a
tag then the values do not appear in the final message. I have already tried encasing the values in quotes and separating them with commas with no luck. I am certain this is an easy fix but i just don't know how. Any ideas.....please!!!
Here is my code:
Code: <?php
if (isset($_POST) && !empty($_POST['Fname'])){
session_start();
$_SESSION['Fname'] = $_POST['Fname'];
}
if (isset($_POST) && !empty($_POST['Lname'])){
session_start();
$_SESSION['Lname'] = $_POST['Lname'];
}
if (isset($_POST) && !empty($_POST['email'])){
session_start();
$_SESSION['email'] = $_POST['email'];
}
if (isset($_POST) && !empty($_POST['phone'])){
session_start();
$_SESSION['phone'] = $_POST['phone'];
}
if (isset($_POST) && !empty($_POST['attend'])){
session_start();
$_SESSION['attend'] = $_POST['attend'];
}
if (isset($_POST) && !empty($_POST['number'])){
session_start();
$_SESSION['number'] = $_POST['number'];
}
if (isset($_POST) && !empty($_POST['trans'])){
session_start();
$_SESSION['trans'] = $_POST['trans'];
}
?>
<?php
/*subject and email variables*/
$emailSubject = 'Survivor or Care Provider Registration';
/*gathering data variables*/
$FnameField = $_POST['Fname'];
$LnameField = $_POST['Lname'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$attendField = $_POST['attend'];
$numberField = $_POST['number'];
$transField = $_POST['trans'];
$attend = implode(', ', $attendField);
$trans = implode(', ', $transField);
/*email field*/
$body = <<<EOD
<hr>
<h2>Registration Confirmation Email</h2>
<hr>
Name Registered: $Fname $Lname
Email Address: $email
Phone Number: $phone
Attending As: $attend
Bringing $number including $Fname $Lname
Will $Fname $Lname need transportation: $trans
Thank you for registering!
EOD;
/*email sender script*/
$sendto = $_POST['email'];
$headers = "From: auto-confirm@xxxxxxxxxxxx.comrn";
$headers .= "Bcc: webmaster@xxxxxxxxxxxx.comrn";
$headers .= "Content-type: text/htmlrn";
$success = mail($sendto, $emailSubject, $body, $headers);
/*resultes*/
$theResults = <<<EOD
<html>
<body>
Thanks!
</body>
</html>
EOD;
echo "$theResults";
?>
No comments posted yet
Your Answer:
Login to answer
345
7
Other forums
Not adding to db
Hi, I can't figure out why it won't add the record to the database. It's just a simple form to get
Something like an INI editor or a DelimitedText-Editor
Hi all,
Am very, very, very new to PHP and not sure if I should be posting this to a Javascri
help connecting a form to php and then emailing the form
Ok. So, I made a form, and I need help to where when submitted, I get an email with the submitted de
Sub-domains & calling unique content
Hello,
Is there a way use something similar to the $_GET function for a sub-domain? I to be a
Spliting paragraph into sentences and attach in
Here is what I am trying to do
example: Para1[123.456.789!] 3 sentences
Para2
Change image filetype on upload?
Hi,
I've got a form which uploads an image to the server.
Is it possible to change the image t
help with contest script
I would like to code a contest script to my site but i don't know how. Could someone just give me pu
how to load a Sys file with system load and call images?
normally you need register the module as a service with CreateService, and start the service
Multiple Dropdown Selections
I have a form that let's a user insert a page with the ability to select categories. I want them to
MySQL Does not UPDATE- SQLString Problem
vb Syntax (Toggle Plain Text)
1.
SQL = "UPDATE sampletable SET column1 = 'C1sample1'"