Hello potential helpers,
I am working on a PHP project, and am having a problem. I need an email sent to this company after someone registers on their website. After the user completes the application, the PHP puts the information into the database, then if successful, emails the company. One of the variables input is the customerID, which is the primary key, unsigned, not null, auto_increment variable.
After I input the info, I cannot send the customerID to the company. My code looks like this so far, and i get two results, either there is no customerID, or when i get an email, the customerID is blank.
if (!$db){
echo "Information was not sent to QPI.";
}
$message = mysql_query("select `customerID` from `applications` where `social`='$social'");
if(!message){
echo "Could not find that customer in the database.";
exit;
}
elseif (mysql_num_rows($message)==0){
echo "Customer ID does not exist. <br />";
exit;
}
elseif (mysql_num_rows($message)>1){
echo "There are too many results. <br />";
exit;
}
elseif (!$customerID){
echo "there is no customer ID";
exit;
}
elseif ($customerID = 'null'){
echo "customer id is blank";
exit;
}
else{
$toaddress = "myemail@isp.com"; // the default value
$subject = "New Insurance Application Filled Out";
$mailcontent = "$customerID";
$fromaddress = "From: [email]company@isp.com[/email]";
mail($toaddress, $subject, $mailcontent, $fromaddress);
}
if(mail($toaddress, $subject, $mailcontent, $fromaddress)){
echo "Information sent successfully to QPI.";
}
please help me figure this out!