I have a client who needed to send the results of the form to a database and then in an email as well. I have made the code for the extras that they need, and then added the Tectite formmail code below. I keep getting the error Call to undefined function FMDebug() which I know is not a problem with the script when used alone. Can you please help me out with this? I am on a tight deadline (this needs to be done today), and I would be so grateful if you could tell me a way to incorporate this formmail with my script. testalert works fine, so I know the email is set up correctly on the form. I'm hoping this is the only problem.

PHP Code:
if ($_POST['name'] != "")$name $_POST['name']; else $name "NULL"; if ($_POST['email'] != "")$email $_POST['email']; else $email "NULL"; if ($_POST['address'] != "")$address $_POST['address']; else $address "NULL"; if ($_POST['city'] != "")$city $_POST['city']; else $city "NULL"; if ($_POST['state'] != "")$state $_POST['state']; else $state "NULL"; if ($_POST['zip'] != "")$zip $_POST['zip']; else $zip "NULL"; if ($_POST['homephone'] != "")$homephone $_POST['homephone']; else $homephone "NULL"; if ($_POST['cellphone'] != "")$cellphone $_POST['cellphone']; else $cellphone "NULL"; if ($_POST['position'] != "")$position $_POST['position'];else $position "NULL"; if ($_POST['shift'] != "")$shift $_POST['shift']; else $shift "NULL"; if ($_POST['status'] != "")$status $_POST['status']; else $status "NULL"; if ($_POST['workedherebefore'] != "")$workedherebefore $_POST['workedherebefore']; else $workedherebefore "NULL"; if ($_POST['previousemploymentdate'] != "")$previousemploymentdate $_POST['previousemploymentdate']; else $previousemploymentdate "NULL"; if ($_POST['referred'] != "")$referred $_POST['referred'];else $referred "NULL"; if ($_POST['empname'] != "")$empname $_POST['empname']; else $empname "NULL"; if ($_POST['under18'] != "")$under18 $_POST['under18']; else $under18 "NULL"; if ($_POST['friends'] != "")$friends $_POST['friends'];else $friends "NULL"; if ($_POST['empname2'] != "")$empname2 $_POST['empname2'];else $empname2 "NULL"; if ($_POST['currentlyemployed'] != "")$currentlyemployed $_POST['currentlyemployed']; else $currentlyemployed "NULL"; if ($_POST['contactemployer'] != "")$contactemployer $_POST['contactemployer']; else $contactemployer "NULL"; if ($_POST['lawful'] != "")$lawful $_POST['lawful']; else $lawful "NULL"; if ($_POST['worktime'] != "")$worktime $_POST['worktime']; else $worktime "NULL"; if ($_POST['workweekends'] != "")$workweekends $_POST['workweekends'];else $workweekends "NULL"; if ($_POST['dateavailable'] != "")$dateavailable $_POST['dateavailable']; else $dateavailable "NULL"; if ($_POST['desiredsalary'] != "")$desiredsalary $_POST['desiredsalary']; else $desiredsalary "NULL"; if ($_POST['position1'] != "")$position1 $_POST['position1']; else $position1 "NULL"; if ($_POST['from1'] != "")$from1 $_POST['from1']; else $from1 "NULL";if ($_POST['to1'] != "")$to1 $_POST['to1']; else $to1 "NULL"; if ($_POST['duties1'] != "")$duties1 $_POST['duties1']; else $duties1 "NULL"; if ($_POST['company1'] != "")$company1 $_POST['company1']; else $company1 "NULL"; if ($_POST['cophone1'] != "")$cophone1 $_POST['cophone1']; else $cophone1 "NULL"; if ($_POST['startsalary'] != "")$startsalary $_POST['startsalary']; else $startsalary "NULL"; if ($_POST['endsalary'] != "")$endsalary $_POST['endsalary']; else $endsalary "NULL"; if ($_POST['reasonleaving1'] != "")$reasonleaving1 $_POST['reasonleaving1']; else $reasonleaving1 "NULL"; if ($_POST['supervisor1'] != "")$supervisor1 $_POST['supervisor1']; else $supervisor1 "NULL"; if ($_POST['contact1'] != "")$contact1 $_POST['contact1']; else $contact1 "NULL"
if (
$_POST['position2'] != "")$position2 $_POST['position2']; else $position2 "NULL"; if ($_POST['from2'] != "")$from2 $_POST['from2']; else $from2 "NULL";if ($_POST['to2'] != "")$to2 $_POST['to2']; else $to2 "NULL"; if ($_POST['duties2'] != "")$duties2 $_POST['duties2']; else $duties2 "NULL"; if ($_POST['company2'] != "")$company2 $_POST['company2']; else $company2 "NULL"; if ($_POST['cophone2'] != "")$cophone2 $_POST['cophone2']; else $cophone2 "NULL"; if ($_POST['startsalary2'] != "")$startsalary2 $_POST['startsalary2']; else $startsalary2 "NULL"; if ($_POST['endsalary2'] != "")$endsalary2 $_POST['endsalary2']; else $endsalary2 "NULL"; if ($_POST['reasonleaving2'] != "")$reasonleaving2 $_POST['reasonleaving2']; else $reasonleaving2 "NULL"; if ($_POST['supervisor2'] != "")$supervisor2 $_POST['supervisor2']; else $supervisor2 "NULL"; if ($_POST['contact2'] != "")$contact2 $_POST['contact2']; else $contact2 "NULL"
if (
$_POST['position3'] != "")$position3 $_POST['position3']; else $position3 "NULL"; if ($_POST['from3'] != "")$from3 $_POST['from3']; else $from3 "NULL";if ($_POST['to3'] != "")$to3 $_POST['to3']; else $to3 "NULL"; if ($_POST['duties3'] != "")$duties3 $_POST['duties3']; else $duties3 "NULL"; if ($_POST['company3'] != "")$company3 $_POST['company3']; else $company3 "NULL"; if ($_POST['cophone3'] != "")$cophone3 $_POST['cophone3']; else $cophone3 "NULL"; if ($_POST['startsalary3'] != "")$startsalary3 $_POST['startsalary3']; else $startsalary3 "NULL"; if ($_POST['endsalary3'] != "")$endsalary3 $_POST['endsalary3']; else $endsalary3 "NULL"; if ($_POST['reasonleaving3'] != "")$reasonleaving3 $_POST['reasonleaving3']; else $reasonleaving3 "NULL"; if ($_POST['supervisor3'] != "")$supervisor3 $_POST['supervisor3']; else $supervisor3 "NULL"; if ($_POST['contact3'] != "")$contact3 $_POST['contact3']; else $contact3 "NULL"
if (
$_POST['comments'] != "")$comments $_POST['comments'];else $comments "NULL"; if ($_POST['training'] != "")$training $_POST['training'];else $training "NULL"; if ($_POST['otherqual'] != "")$otherqual $_POST['otherqual']; else $otherqual "NULL"; if ($_POST['documents'] != "")$documents $_POST['documents']; else $documents "NULL"; if ($_POST['dltype'] != "")$dltype $_POST['dltype']; else $dltype "NULL"; if ($_POST['dlstate'] != "")$dlstate $_POST['dlstate']; else $dlstate "NULL"; if ($_POST['expdate'] != "")$expdate $_POST['expdate']; else $expdate "NULL"; if ($_POST['yearsdriving'] != "")$yearsdriving $_POST['yearsdriving']; else $yearsdriving "NULL"; if ($_POST['movingviolations'] != "")$movingviolations $_POST['movingviolations']; else $movingviolations "NULL"; if ($_POST['hsname'] != "")$hsname $_POST['hsname']; else $hsname "NULL"; if ($_POST['hscity'] != "")$hscity $_POST['hscity'];else $hscity "NULL"; if ($_POST['hsstate'] != "")$hsstate $_POST['hsstate']; else $hsstate "NULL"; if ($_POST['hsdates'] != "")$hsdates $_POST['hsdates']; else $hsdates "NULL"; if ($_POST['collegename'] != "")$collegename $_POST['collegename']; else $collegename "NULL"; if ($_POST['collegecity'] != "")$collegecity $_POST['collegecity']; else $collegecity "NULL"; if ($_POST['collegestate'] != "")$collegestate $_POST['collegestate']; else $collegestate "NULL"; if ($_POST['collegedates'] != "")$collegedates $_POST['collegedates']; else $collegedates "NULL"; if ($_POST['othername'] != "")$othername $_POST['othername']; else $othername "NULL"; if ($_POST['othercity'] != "")$othercity $_POST['othercity']; else $othercity "NULL"; if ($_POST['otherstate'] != "")$otherstate $_POST['otherstate']; else $otherstate "NULL"; if ($_POST['otherdates'] != "")$otherdates $_POST['otherdates']; else $otherdates "NULL"; if ($_POST['licenseorcert'] != "")$licenseorcert $_POST['licenseorcert']; else $licenseorcert "NULL"; if ($_POST['refname1'] != "")$refname1 $_POST['refname1']; else $refname1 "NULL"; if ($_POST['refbusiness1'] != "")$refbusiness1 $_POST['refbusiness1']; else $refbusiness1 "NULL"; if ($_POST['reftitle1'] != "")$reftitle1 $_POST['reftitle1']; else $reftitle1 "NULL"; if ($_POST['refaddress1'] != "")$refaddress1 $_POST['refaddress1']; else $refaddress1 "NULL"; if ($_POST['refphone1'] != "")$refphone1 $_POST['refphone1']; else $refphone1 "NULL"; if ($_POST['refname2'] != "")$refname2 $_POST['refname2']; else $refname2 "NULL"; if ($_POST['refbusiness2'] != "")$refbusiness2 $_POST['refbusiness2']; else $refbusiness2 "NULL"; if ($_POST['reftitle2'] != "")$reftitle2 $_POST['reftitle2']; else $reftitle2 "NULL"; if ($reftitle2 != "")$refaddress2 $_POST['refaddress2']; else $refaddress2 "NULL"; if ($_POST['refphone2'] != "")$refphone2 $_POST['refphone2']; else $refphone2 "NULL"; if ($_POST['refname3'] != "")$refname3 $_POST['refname3']; else $refname3 "NULL"; if ($_POST['refbusiness3'] != "")$refbusiness3 $_POST['refbusiness3']; else $refbusiness3 "NULL"; if ($_POST['reftitle3'] != "")$reftitle3 $_POST['reftitle3']; else $reftitle3 "NULL"; if ($_POST['refaddress3'] != "")$refaddress3 $_POST['refaddress3']; else $refaddress3 "NULL"; if ($_POST['refphone3'] != "")$refphone3 $_POST['refphone3']; else $refphone3 "NULL"; if ($_POST['felony'] != "")$felony $_POST['felony']; else $felony "NULL"; if ($_POST['iffelony'] != "")$iffelony $_POST['iffelony']; else $iffelony "NULL"; if ($_POST['fired'] != "")$fired $_POST['fired']; else $fired "NULL"; if ($_POST['iffired'] != "")$iffired $_POST['iffired']; else $iffired "NULL"; if ($_POST['resident'] != "")$resident $_POST['resident']; else $resident "NULL"; if ($_POST['explanation'] != "")$explanation $_POST['explanation']; else $explanation "NULL"; if ($_POST['signed'] != "")$signed $_POST['signed']; else $signed "NULL"; if ($_POST['q1'] != "")$q1 $_POST['q1']; else $q1 "NULL"; if ($_POST['q2'] != "")$q2 $_POST['q2']; else $q2 "NULL"; if ($_POST['q3'] != "")$q3 $_POST['q3']; else $q3 "NULL"; if ($_POST['q4'] != ""$q4 $_POST['q4']; else $q4 "NULL"; if ($_POST['mq1'] != "")$mq1 $_POST['mq1']; else $mq1 "NULL"; if ($_POST['mq2'] != "")$mq2 $_POST['mq2']; else $mq2 "NULL"; if ($_POST['mq3'] != "")$mq3 $_POST['mq3']; else $mq3 "NULL"; if ($_POST['mq4'] != "")$mq4 $_POST['mq4']; else $mq4 "NULL"; if ($_POST['mq5'] != "")$mq5 $_POST['mq5']; else $mq5 "NULL"; if ($_POST['mq6'] != "")$mq6 $_POST['mq6']; else $mq6 "NULL"; if ($_POST['mq7'] != "")$mq7 $_POST['mq7']; else $mq7 "NULL"; if ($_POST['mq8'] != "")$mq8 $_POST['mq8']; else $mq8 "NULL"; if ($_POST['mq9'] != "")$mq9 $_POST['mq9']; else $mq9 "NULL"; if ($_POST['mq10'] != "")$mq10 $_POST['mq10']; else $mq10 "NULL"; if ($_POST['mq11'] != "")$mq11 $_POST['mq11']; else $mq11 "NULL"; if ($_POST['mq12'] != "")$mq12 $_POST['mq12']; else $mq12 "NULL"; if ($_POST['mq13'] != "")$mq13 $_POST['mq13']; else $mq13 "NULL"; if ($_POST['mq14'] != "")$mq14 $_POST['mq14']; else $mq14 "NULL"; if ($_POST['mq15'] != "")$mq15 $_POST['mq15']; else $mq15 "NULL"; if ($_POST['mq16'] != "")$mq16 $_POST['mq16']; else $mq16 "NULL"; if ($_POST['mq17'] != "")$mq17 $_POST['mq17']; else $mq17 "NULL"; if ($_POST['mq18'] != "")$mq18 $_POST['mq18']; else $mq18 "NULL"; if ($_POST['mq19'] != "")$mq19 $_POST['mq19'];else $mq19 "NULL"; if ($_POST['mq20'] != "")$mq20 $_POST['mq20']; else $mq20 "NULL"; if ($_POST['mq21'] != "")$mq21 $_POST['mq21']; else $mq21 "NULL"; if ($_POST['mq22'] != "")$mq22 $_POST['mq22']; else $mq22 "NULL"; if ($_POST['mq23'] != "")$mq23 $_POST['mq23']; else $mq23 "NULL"; if ($_POST['mq24'] != "")$mq24 $_POST['mq24']; else $mq24 "NULL"; if ($_POST['mq24b'] != "")$mq24b $_POST['mq24b']; else $mq24b "NULL"; if ($_POST['mq25'] != "")$mq25 $_POST['mq25']; else $mq25 "NULL"; if ($_POST['mq25b'] != "")$mq25b $_POST['mq25b']; else $mq25b "NULL"; if ($_POST['mq26'] != "")$mq26 $_POST['mq26']; else $mq26 "NULL"; if ($_POST['mq27a'] != "")$mq27a $_POST['mq27a']; else $mq27a "NULL"; if ($_POST['mq27b'] != "")$mq27b $_POST['mq27b']; else $mq27b "NULL"; if ($_POST['mq27c'] != "")$mq27c $_POST['mq27c']; else $mq27c "NULL"; if ($_POST['mq28'] != "")$mq28 $_POST['mq28']; else $mq28 "NULL"; if ($_POST['mq29'] != "")$mq29 $_POST['mq29']; else $mq29 "NULL"; if ($_POST['mq30answer'] != "")$mq30answer $_POST['mq30answer']; else $mq30answer "NULL"; if ($_POST['disclosuresig'] != "")$disclosuresig $_POST['disclosuresig']; else $disclosuresig "NULL"; if ($_POST['verify_name'] != "")$verify_name $_POST['verify_name']; else $verify_name "NULL"; if ($_POST['other_names'] != "")$other_names $_POST['other_names']; else $other_names "NULL"; if ($_POST['ssn'] != "")$ssn $_POST['ssn']; else $ssn "NULL"; if ($_POST['dob'] != "")$dob $_POST['dob']; else $dob "NULL";       
$key "key is here";
$conn mysql_connect("localhost""kbadmin""wuhtyIwBT4o7aq");
if (
$conn === FALSE){    echo "<p>Unable to connect to the database server.</p>" "<p>Error Code " .    mysql_errno() . ":" mysql_error() . "</p>";}    else{    $db "kbadmin_joomla";        mysql_select_db($db$conn) or die("Problems");
            
$SQLstring "INSERT INTO applications (name, address, city, state, zip, homephone, cellphone, position, shift, status, workedherebefore, previousemploymentdate, referred, empname, under18, friends, empname2,  currentlyemployed, contactemployer, lawful, worktime, workweekends, dateavailable, desiredsalary,  position1, from1, to1, duties1, company1, cophone1, startsalary, endsalary, reasonleaving1, supervisor1, contact1, position2, from2, to2, duties2, company2, cophone2, startsalary2,  endsalary2, reasonleaving2, supervisor2, contact2, position3, from3, to3, duties3, company3,  cophone3, startsalary3, endsalary3, reasonleaving3, supervisor3, contact3, comments, training,  otherqual, documents, dltype, dlstate, expdate, yearsdriving,  movingviolations, hsname, hscity,  hsstate, hsdates,  collegename, collegecity, collegestate, collegedates, othername,  othercity,  otherstate, otherdates, licenseorcert, refname1, refbusiness1, reftitle1, refaddress1, refphone1,  refname2, refbusiness2, reftitle2, refaddress2, refphone2, refname3, refbusiness3, reftitle3,  refaddress3, refphone3,felony, iffelony, fired, iffired, resident, explanation, signed, q1, q2, q3,  q4, mq1, mq2, mq3, mq4, mq5, mq6, mq7, mq8, mq9, mq10, mq11, mq12, mq13, mq14, mq15, mq16, mq17, mq18, mq19, mq20, mq21, mq22, mq23, mq24, mq24b, mq25, mq25b, mq26, mq27a, mq27b, mq27c,  mq28, mq29, mq30answer, disclosuresig, verify_name, other_names, ssn, dob) VALUES ('$name', '$address', '$city', '$state', '$zip', '$homephone', '$cellphone', '$position', '$shift', '$status', '$workedherebefore', '$previousemploymentdate', '$referred', '$empname', '$under18', '$friends', '$empname2',  '$currentlyemployed', '$contactemployer', '$lawful', '$worktime', '$workweekends', '$dateavailable', '$desiredsalary',  '$position1', '$from1', '$to1', '$duties1', '$company1', '$cophone1', '$startsalary', '$endsalary', '$reasonleaving1', '$supervisor1', '$contact1', '$position2', '$from2', '$to2', '$duties2', '$company2', '$cophone2', '$startsalary2',  '$endsalary2', '$reasonleaving2', '$supervisor2', '$contact2', '$position3', '$from3', '$to3', '$duties3', '$company3',  '$cophone3', '$startsalary3', '$endsalary3', '$reasonleaving3', '$supervisor3', '$contact3', '$comments', '$training',  '$otherqual', '$documents', '$dltype', '$dlstate', '$expdate', '$yearsdriving',  '$movingviolations', '$hsname', '$hscity',  '$hsstate', '$hsdates',  '$collegename', '$collegecity', '$collegestate', '$collegedates', '$othername',  '$othercity',  '$otherstate', '$otherdates', '$licenseorcert', '$refname1', '$refbusiness1', '$reftitle1', '$refaddress1', '$refphone1',  '$refname2', '$refbusiness2', '$reftitle2', '$refaddress2', '$refphone2', '$refname3', '$refbusiness3', '$reftitle3',  '$refaddress3', '$refphone3 ', '$felony', '$iffelony', '$fired', '$iffired', '$resident', '$explanation', '$signed', '$q1', '$q2', '$q3',  '$q4', '$mq1', '$mq2', '$mq3', '$mq4', '$mq5', '$mq6', '$mq7', '$mq8', '$mq9', '$mq10', '$mq11', '$mq12', '$mq13', '$mq14', '$mq15', '$mq16', '$mq17', '$mq18', '$mq19', '$mq20', '$mq21', '$mq22', '$mq23', '$mq24', '$mq24b', '$mq25', '$mq25b', '$mq26', '$mq27a', '$mq27b', '$mq27c',  '$mq28', '$mq29', '$mq30answer', '$disclosuresig', '$verify_name', '$other_names', AES_ENCRYPT($ssn, '$key'), '$dob')";
}
$QueryResult = @mysql_query($SQLstring$conn);if ($QueryResult === FALSE)    echo "Unable to add to database" "<br />Error Code: " mysql_errno($conn) . ": " mysql_error($conn);else{

$FM_VERS "8.36";      // begin formmail

//formmail continues (set up properly)

}
mysql_close($conn);