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<payments@americangangsters.org>"); 
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.