Solved

Email Messages Not Showing

Posted on 2013-06-25
2
179 Views
Last Modified: 2013-06-25
I am building an E-Mail message from a MySQL database.  The problem is that only the last message is showing and only the label at that.  What am I doing wrong?

$to = $_POST['ESend'];
 	$subject = "Menuhead.com";
 	$message = "Name: ".$_POST["RestName"]."\n";
	$message = "Address: ".$_POST["StreetNumber"]."\n";
	$message = "Address: ".$_POST["StreetName"]."\n";
	$message = "Address: ".$_POST["CrossOne"]."\n";
	$message = "Address: ".$_POST["CrossTwo"]."\n";
	$message = "City: ".$_POST["CityName"]."\n";
	$message = "State: ".$_POST["StateName"]."\n";
	$message = "Zip Code: ".$_POST["ZipCodeName"]."\n";
	$message = "Phone: ".$_POST["Phone"]."\n";
	$message = "Email: ".$_POST["Email"]."\n";
	$message = "Fax: ".$_POST["Fax"]."\n";
	$message = "SMS: ".$_POST["SMS"]."\n";
	
 	$from = "Menuhead.com";
 	$headers = "From:" . $from;
 	mail($to,$subject,$message,$headers);
 	echo "Mail Sent.";

Open in new window


I also wnat to combine the StreetNumber and StreetName fields together.  Thank you.
0
Comment
Question by:DS928
2 Comments
 
LVL 4

Accepted Solution

by:
ScorchD earned 500 total points
ID: 39275859
You have $message as a variable not an array, you can just enter like

$name = $_POST['name'];
$email = $_POST['email'];
$message=" Name: $name \n Email: $email \n";

Open in new window

0
 

Author Comment

by:DS928
ID: 39275870
Still not showing.  Here is the entire page, maybe the problem is somewhere else?

<?php
include("config.php");
$Lid = $_GET['Lid'];
$Lid = mysql_real_escape_string($Lid);  
mysql_query("SET CHARACTER SET utf8");
$sql=mysql_query("SELECT tblRestaurants.RestName,tblLocations.StreetNumber,tblLocations.Street,
	tblLocations.CrossOne, tblLocations.CrossTwo, tblCities.CityName,tblStates.StateName,tblZipCodes.ZipCodeName,
	tblLocations.Phone,tblLocations.Email, tblLocations.Fax, tblLocations.SMS, tblLocations.LocationID
	FROM tblLocations
	INNER JOIN tblRestaurants ON tblRestaurants.RestID = tblLocations.RestID
	INNER JOIN tblCities ON tblCities.CityID = tblLocations.CityID
	INNER JOIN tblStates ON tblStates.StateID = tblLocations.StateID
	INNER JOIN tblZipCodes ON tblZipCodes.ZipCodeID = tblLocations.ZipCodeID
	WHERE tblLocations.LocationID = '$Lid'");
	while($row=mysql_fetch_array($sql))
	{
	$RestName = $row['RestName'];
	$StreetNumber = $row['StreetNumber'];
	$Street = $row['Street'];
	$CrossOne = $row['CrossOne'];
	$CrossTwo = $row['CrossTwo'];
	$City = $row['CityName'];
	$State = $row['StateName'];
	$ZipCode = $row['ZipCodeName'];
	$Phone = $row['Phone'];
	$Email = $row['Email'];
	$Fax = $row['Fax'];
	$SMS = $row['SMS'];
	$Lid = $row['LocationID'];
	}
 
    $to = $_POST['ESend'];
 	$subject = "Menuhead.com";
 	$RestName = $_POST['RestName'];
	$Email = $_POST['Email'];
	$message=" Name: $RestName \n Email: $Email \n";
 	$from = "Menuhead";
 	$headers = "From:" . $from;
 	mail($to,$subject,$message,$headers);
 	echo "Mail Sent.";
 ?>

Open in new window

0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question