I'm trying to send a confirmation email to the person who submitted this "ticket" but it's not sending. I know the right info is there it just seems like I'm putting something in the wrong spot.
Anyone help me out?
<?php
include("database.php");
$today = date("M d Y");
$sql="INSERT INTO info (Ticket, Dateadded, Name, Email, Issue, Cat, Descript, Trouble, Device, Priority)
VALUES
('$_POST[ticket]','$today','$_POST[name]','$_POST[email]','$_POST[issue]','$_POST[cat]','$_POST[descript]','$_POST[trouble]','$_POST[device]','$_POST[priority]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
else
{
$query = "SELECT ticket, dateadded, name, email, issue, descript, cat, device, trouble, priority FROM info ORDER by ticket DESC LIMIT 1";
$result = mysql_query($query);
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
echo "<div class=\"thankyou\"><p>{$row['name']},</p><p>Thank you for submitting a request to get this issue resolved. Your ticket # is <b>{$row['ticket']}</b>. You will be notified by email if we need any more information or when we've fixed this issue.</p><br />" .
"<p>-Support Team</p></div>";
}
}
$to = "{$row['email']}@example.com";
$subject = "Support - {$row['cat']} - Ticket #{$row['ticket']}";
$message = "Hello {$row['name']},\n\n Thank you for submitting a request to get this issue resolved. Your ticket # is {$row['ticket']}. You will be notified by email if we need any more information or when we've fixed this issue.\n\n-Support Team";
$from = "IT@group.example.com";
$headers = "From: $from";
mail($to,$subject,$message,$headers);
mysql_close($con)
?>