Solved

Email Messages Not Showing

Posted on 2013-06-25
2
175 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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
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…
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…

757 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now