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
Why does my crawler script suddenly end with no error?
Hi.
I have written a web crawler script. It will visit a large number of URL's with cURL.
session checking in page load
hai all
I have a web site is www.Mryas.com in this my login page is Page1.aspx its co
defining website tags
Hi,
What would be the best way to define tags for my site, such as website title, url etc.
Wierd if else problem
Hi guys,
this probably aint wierd for you, but it seems like php is playin up to me. may b i
How do I know when getBounds Method is ready to be called.
I have an application that changes out stylesheets client side. Once I change stylesheet the browse
Need help/w Page: 1,2,3,4 function!
So I have this code im working on where it's ment to display seperate pages having 20 logs each
I
Thread in PHP
Thread in PHP
Some basic use and basic code for thread in php
This is my question?
Advice on how to delete a mysql row using my form
Hi,
I am very new to php and am struggling to work out how to delete a portfolio item (a row
Save data in input fields when they press "BACK BUTTON"
Hi, this is html form: And let's say they get a error "Please enter ur title must be more then
single page with referrer to show correct page
I have a simple website with a couple of different pages. I would like to be able to in a div tag w