sandbudd Posted July 13, 2010 Share Posted July 13, 2010 Hey guys I have a form that populates the database and then sends a confirmation to the sender and sends me a email this works great. What I am trying to accomplish is that when the sender receives the confirmation email, I would like the id in the database to be their confirmation number displaying in the email. Hope I was clear. I have tried several things and can't get it to work. Here is the code that I have that does work just need the add on to display the id number. Thanks in advance. <?php $sendto = $_POST['Email']; // this is the email address collected form the form $ccto = "mail@mail"; $subject = "Subject"; // Subject $message = "Congratulations $FirstName $LastName "; $header = "From: [email protected]\r\n"; $header .= "Reply-to: mail@mail\r\n"; $header .= "BCC: mail@mail\r\n"; // This is the function to send the email $sendto = $sendto.', '.$ccto; mail($sendto, $subject, $message, $header); ?> <?php $where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/")); include("config.inc.php"); $link = mysql_connect($db_host,$db_user,$db_pass); if(!$link) die ('Could not connect to database: '.mysql_error()); mysql_select_db($db_name,$link); $query = "INSERT into `".$db_table."` (FirstName,LastName,Address,City,State,Zip,OtherPhone,CellPhone,field_8,Email,AddressYears,AddressMonths,PreviousYears,PreviousMonths,Rent,Mortgage,AreaYears,AreaMonths,DD,MM,YY,SS1,SS2,SS3,License,Employer,JobTitle,EmployerYears,EmployerMonths,Income,PreviousEmployerYears,PreviousEmployerMonths,EmployerNumber,Repo,RepoNumber,RepoBank1,Repo1Years,Repo2Years,RepoBank2,RepoTime2,RepoTime3,CarLoan,TradeLoan,TradeYear,TradePayoff,PaidTrade,TradeDescription,BK,Discharged,BKYears,BKMonths,field_51,field_52,field_53,field_54,field_55) VALUES ('" . $_POST['FirstName'] . "','" . $_POST['LastName'] . "','" . $_POST['Address'] . "','" . $_POST['City'] . "','" . $_POST['State'] . "','" . $_POST['Zip'] . "','" . $_POST['OtherPhone'] . "','" . $_POST['CellPhone']. "','" . $_POST['field_8'] . "','" . $_POST['Email'] . "','" . $_POST['AddressYears'] . "','" . $_POST['AddressMonths'] . "','" . $_POST['PreviousYears'] . "','" . $_POST['PreviousMonths'] . "','" . $_POST['Rent'] . "','" . $_POST['Mortgage'] . "','" . $_POST['AreaYears'] . "','" . $_POST['AreaMonths'] . "','" . $_POST['DD'] . "','" . $_POST['MM'] . "','" . $_POST['YY'] . "','" . $_POST['SS1'] . "','" . $_POST['SS2'] . "','" . $_POST['SS3'] . "','" . $_POST['License'] . "','" . $_POST['Employer'] . "','" . $_POST['JobTitle'] . "','" . $_POST['EmployerYears'] . "','" . $_POST['EmployerMonths'] . "','" . $_POST['Income'] . "','" . $_POST['PreviousEmployerYears'] . "','" . $_POST['PreviousEmployerMonths'] . "','" . $_POST['EmployerNumber'] . "','" . $_POST['Repo'] . "','" . $_POST['RepoNumber'] . "','" . $_POST['RepoBank1'] . "','" . $_POST['Repo1Years'] . "','" . $_POST['Repo2Years'] . "','" . $_POST['RepoBank2'] . "','" . $_POST['RepoTime2'] . "','" . $_POST['RepoTime3'] . "','" . $_POST['CarLoan'] . "','" . $_POST['TradeLoan'] . "','" . $_POST['TradeYear'] . "','" . $_POST['TradePayoff'] . "','" . $_POST['PaidTrade'] . "','" . $_POST['TradeDescription'] . "','" . $_POST['BK'] . "','" . $_POST['Discharged'] . "','" . $_POST['BKYears'] . "','" . $_POST['BKMonths'] . "','" . $_POST['field_51'] . "','" . $_POST['field_52'] . "','" . $_POST['field_53'] . "','" . $_POST['field_54'] . "','" . $_POST['field_55'] . "')"; mysql_query($query); mysql_close($link); include("confirm.html"); ?> Link to comment https://forums.phpfreaks.com/topic/207644-form-populates-database-message-sent-want-to-be-id/ Share on other sites More sharing options...
ocpaul20 Posted July 14, 2010 Share Posted July 14, 2010 So where is the code to add the id to the email message body or subject or wherever? write the database record, get the id of the database record just written, send the email with the id in it. It seems that there is code missing from your example? Link to comment https://forums.phpfreaks.com/topic/207644-form-populates-database-message-sent-want-to-be-id/#findComment-1085673 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.