<?
require_once("conn.php");
require_once("includes.php");
//Move to vars, easier to work with.
$ListingID = intval($_GET['ListingID']);
$AgentID = intval($_GET['AgentID']);
$q1 = mysql_query("SELECT * FROM re2_agents WHERE AgentID = ".$AgentID) or die(mysql_error());
$a1 = mysql_fetch_array($q1);
if(isset($_POST['s1']))
{
$to = $a1['email'];
$subject = $_POST['subject'];
$message = $_POST['message'];
$message .= 'Property:'."\n".$site_url.'/info.php?id='.$ListingID."\n\n";
$headers .= 'Content-type: text/plain; charset=iso-8859-1'."\r\n";
$headers .= 'Content-Transfer-Encoding: 8bit'."\r\n";
$headers .= 'From: '.$_POST['u_name'].' <'.$_POST['u_email'].'>'."\r\n";
if(!@mail($to, $subject, $message, $headers))
{
echo "error";
}
$thankyou = '<center><b><br><br><br>Thank you for your message!<br><br><a class=RedLink href="'.$site_url.'/info.php?id='.$ListingID.'">back to the property details</a></center>';
require_once("templates/HeaderTemplate.php");
require_once("templates/EmailThankyouTemplate.php");
require_once("templates/FooterTemplate.php");
}
$AgentName = $a1['FirstName'].' '.$a1['LastName'];
/*
Here is where the error occured, in what I originally posted it
was because I forgot that:
"empty() only checks variables as anything else will result in a
parse error. In other words, the following will not work:
empty(trim($name))."
*/
if(!empty($ListingID))
{
$SubjectLine = "Property ID ".$ListingID;
}
require_once("templates/HeaderTemplate.php");
require_once("templates/EmailTemplate.php");
require_once("templates/FooterTemplate.php");
?>