Solved

Email Messages Not Showing

Posted on 2013-06-25
2
182 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.

688 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