The following fields are required as a minimum:
\n"; print "First Name, Last Name, and Phone Number
\n"; print "Click Back in your browser to re-enter the application form
\n"; } // // if we have minimum then attempt to open and upload files // else { // BEGIN LONG ELSE STATEMENT print "PROCESSING FORM DATA....

"; // // SAVE ERROR MESSAGES AS A STRING // $ErrMsg = ""; // // set up Loan Officer paths and files for writing and reading // $LOFORM = $LODIR . "/loanapps/" . ereg_replace(" ", "_", $BLastName) . ereg_replace(" ", "_", $BFirstName) . $LODIR . "FORM.txt"; ....... // // /////////////////////////////////////// // // PROCESS BYTE TEXT FILES // /////////////////////////////////////// // // $OpenLOBYTE = fopen ($LOBYTE, "w"); $OpenPaulBYTE = fopen ($PaulBYTE, "w"); $OpenBLANK = fopen ($BLANK, "r"); if ((!$OpenLOBYTE) OR (!$OpenPaulBYTE) OR (!$OpenBLANK)) { $ErrMsg = $ErrMsg . "\nOpening BYTE Text Files $LOBYTE"; } $TODAYSDATE = date("n/d/Y h:i:s A"); // // check if CoB address same as Bor // if ($CCSame) { $CAddr = $BAddr; $CCity = $BCity; $CState = $BState; $CZip = $BZip; } if ($CFSame) { $CFAddr = $BFAddr; $CFCity = $BFCity; $CFState = $BFState; $CFZip = $BFZip; } // // function that returns the string preceded by 000## or 0000# // depending on the length of the string // function ZLEN($STR) { $LEN = strlen($STR); if ($LEN < 10) return ("0000" . $LEN . $STR); else return ("000" . $LEN . $STR); } // // function that returns the decimal value of years // from the years and months passed to the function // function DECYEAR($NumYears, $NumMonths) { $DecMonths = ""; if ($NumMonths == "1") $DecMonths = ".083"; if ($NumMonths == "2") $DecMonths = ".167"; if ($NumMonths == "3") $DecMonths = ".25"; if ($NumMonths == "4") $DecMonths = ".333"; if ($NumMonths == "5") $DecMonths = ".417"; if ($NumMonths == "6") $DecMonths = ".5"; if ($NumMonths == "7") $DecMonths = ".583"; if ($NumMonths == "8") $DecMonths = ".667"; if ($NumMonths == "9") $DecMonths = ".75"; if ($NumMonths == "10") $DecMonths = ".833"; if ($NumMonths == "11") $DecMonths = ".917"; return ($NumYears . $DecMonths); } ....... /////////////////////////////////////////// // // CHECK IF VALID FILES UPLOADED // // IF SO, THEN SEND CONFIRMATION EMAILS // // IF NOT, THEN SEND ERROR MESSAGE AND // TELL APPLICANT TO PRESS SUBMIT AGAIN // /////////////////////////////////////////// if (@filesize($LOBYTE) < 20000) { $ErrMsg = $ErrMsg . "\nWriting to BYTE Text Files $LOBYTE -- File Size < 20K"; } if ($ErrMsg) { print "There was an error sending your application to our web server.

You can click Back in your web browser to retain the data and
re-submit the mortgage application.

If this problem persists, please try again later.
We apologize for any inconvenience.

"; } else { print "Your application has been received. If you entered a valid Email address you will be sent an Email from
"; print "$LOName of Mortgage In Minutes, Inc. Thank you.

"; // // set up Body string of Email to Customer // $Body = "$BFirstName $BMI $BLastName:\n\nThank you for applying online with $LOName of Mortgage In Minutes, Inc. If you have any questions, you may reach $LOName at $LOPhone or at the office (727)210-0808 ext $LOExt for further information.\n\nSincerely,\n\nMortgage In Minutes\n\nhttp://$LOWeb"; if (($BEmail) AND (mail($BEmail, "Mortgage In Minutes has received your online application", $Body, "From: $LOEmail"))) { print "Confirmation EMail to $BEmail sent....
"; } else { print "There was an error sending the confirmation Email.
Either the Email was left blank, or there is a temporary problem
with our Email server.
"; $ErrMsg = $ErrMsg . "\nSending Confirmation Email To $BFirstName $BLastName Email=$BEmail"; } ....... // //////////////////////////////////////////// // // Add form data to LIST.txt file // /////////////////////////////////////////// // $OpenLOLIST = fopen ($LOLIST, "a"); $OpenPaulLIST = fopen ($PaulLIST, "a"); if ((!$OpenLOLIST) OR (!$OpenPaulLIST)) { $ErrMsg = $ErrMsg . "\nOpening List Text Files $LOLIST"; } if (!$BEmail) $BEmail = "NO EMAIL"; $FileData = $LODIR . "\n" . ereg_replace(" ", "_", $BFirstName) . "\n" . $BMI . "\n" . ereg_replace(" ", "_", $BLastName) . "\n" . $BEmail . "\n" . "(" . $BPh1 . ")" . $BPh2 . "-" . $BPh3 . "\n" . $LoanType . "\n" . $LoanAmount . "\n" . $PropPurpose . "\n"; if ((fwrite($OpenLOLIST, $FileData) < 0) OR (fwrite($OpenPaulLIST, $FileData) < 0)) { $ErrMsg = $ErrMsg . "\nWriting to List Text Files $LOLIST"; } fclose ($OpenLOLIST); fclose ($OpenPaulLIST); print "Form Data processed and sent...

"; ....... END OF SAMPLE PHP CODE