Jump to content

[SOLVED] php send email / a few errors


AsiaUnderworld

Recommended Posts

Hi there, im using the php mail function to send an email after a form is run, however when i get the email, it just says Dear 'Array', and hello Array , rather than the printed username, it also says

 

Undefined index: email in /home/vheissu/public_html/feedback.php on line 20

Undefined index: email in /home/vheissu/public_html/feedback.php on line 47

 

both of these lines are : $email = $_POST['email'];

 

otherwise here is the code :)

 

<?
$id = (int) $_SESSION['user_id'];
$email = $_POST['email'];

if(isset($_POST['submit']))
{
$topic = mysql_real_escape_string($_POST['topic']);

$ticket = mysql_real_escape_string($_POST['ticket']);

if (strlen($topic) < 1)
	echo "<div align=center>Please enter a topic</div>";
elseif(strlen($ticket) < 1)
	echo "<div align=center>Please Enter ticket information</div>";
else
{
	$sql =  mysql_query("INSERT INTO helpdesk (topic,message,user) VALUES ('$topic','$ticket','".mysql_real_escape_string($id)."')");

	if($sql)
		echo "<div align=center>Ticket submitted</div>";
	else
		echo "<div align=center>There is a problem sending the ticket</div>";
}
}

$id = (int) $_SESSION['user_id'];
$sql2 = mysql_query("SELECT username FROM user_details WHERE id = '".mysql_real_escape_string($id)."'");
$username = mysql_fetch_assoc($sql2);

$email = $_POST['email'];


    $subject = "American Gangsters"; 
    $message = "Dear '".$username."', 

    Hello $username , thank you for signing up with American Gangsters
  
    Your Feedback is important to us.
     
                
    This is an automated response, please do not reply!"; 
     
    mail($email, $subject, $message, 
        "From: American Gangsters<[email protected]>"); 
?>

Link to comment
https://forums.phpfreaks.com/topic/153499-solved-php-send-email-a-few-errors/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.