know what I mean? I'm trying to write a script where the results of a form are inserted into a mysql table, and then emailed to people. I got those two things done fine, but now I'm trying to figure out a way to insert the key into the subject of the email. Problem is, I can't use that as a field, becuase it hasn't been defined. I thought of assigning a variable, like $tempkey as NULL, but it wouldn't get changed while performing the INSERT command. Here's the code, and if you get any ideas, please help me out. Ideally I'd like to have a link to the detail of that record right in the email, but getting the key out is 'key' (pun intended.
<?php
require_once('../Connections/Connection.php');
mysql_select_db($database_Connection, $Connection);
$now = date('m-d-Y H:i');
$sqlquery = "INSERT INTO tickets (ticketKey,timeStamp,company,companyKey,site,contact,phoneNumber,status,problemWith,issue,fix)
VALUES ('','$now','$companyName','$companyKey','$siteName','$contact','$PhoneNumber','$status','$problem','$issue','$fix')";
$results = mysql_query($sqlquery);

foreach ($emailTo as $value ){
if ($contactName == 'None'){
$contact = $contactOther;
}
else if ($contactName != 'None'){
$contact = $contactName;
}
$message .= "Company Name: $companyName \n";
$message .= "Contact: $contact \n";
$message .= "Site Name: $siteName \n";
$message .= "Contact Person's Phone Number: $PhoneNumber \n";
$message .= "Support Level: $supportType \n";
$message .= "Expiration Date of Support: $supportExpires \n";
$message .= "Sales Representative: $salesRep \n";
$message .= "Problem With: $problem \n";
$message .= "Description of Problem: $issue \n";
$message .= "Fix: $fix \n";
mail($value , 'Support Ticket Opened:'$issue //this is where I want the key, $message);
}
foreach ($customerEmail as $value){
if ($contactName == 'None'){
$contact = $contactOther;
}
else if ($contactName != 'None'){
$contact = $contactName;
}
$message .= "Company Name: $companyName \n";
$message .= "Contact: $contact \n";
$message .= "Site Name: $siteName \n";
$message .= "Contact Person's Phone Number: $PhoneNumber \n";
$message .= "Support Level: $supportType \n";
$message .= "Expiration Date of Support: $supportExpires \n";
$message .= "Sales Representative: $salesRep \n";
$message .= "Problem With: $problem \n";
$message .= "Description of Problem: $issue \n";
$message .= "Fix: $fix \n";
mail($value , 'Support Ticket Opened:'$issue //this is where I want the key, $message);
}
$success = "1";
header ( "Location: http://xxxxxxxxxxxx.php");
?>