$micrObj = new MICRReader(); //Is this the second pass? if (isset($_POST["PledgeSubmit"]) || isset($_POST["PledgeSubmitAndAdd"]) || isset($_POST["MatchFamily"]) || isset($_POST["MatchEnvelope"]) || isset($_POST["SetDefaultCheck"])) { $iFamily = 0; $iCheckNo = 0; // Take care of match-family first- select the family based on the scanned check if (isset($_POST["MatchFamily"])) { $tScanString = FilterInput($_POST["ScanInput"]); $routeAndAccount = $micrObj->FindRouteAndAccount($tScanString); // use routing and account number for matching if ($routeAndAccount) { $sSQL = "SELECT fam_ID FROM family_fam WHERE fam_scanCheck REGEXP \"" . $routeAndAccount . "\""; $rsFam = RunQuery($sSQL); extract(mysql_fetch_array($rsFam)); $iFamily = $fam_ID; $iCheckNo = $micrObj->FindCheckNo($tScanString); } else { $iFamily = FilterInput($_POST["Family"], 'int'); $iCheckNo = FilterInput($_POST["CheckNo"], 'int'); } } else { if (isset($_POST["MatchEnvelope"])) { // Match envelope is similar to match check- use the envelope number to choose a family $iEnvelope = FilterInput($_POST["Envelope"], 'int'); $sSQL = "SELECT fam_ID FROM family_fam WHERE fam_Envelope=" . $iEnvelope; $rsFam = RunQuery($sSQL); extract(mysql_fetch_array($rsFam)); $iFamily = $fam_ID; } else { $iFamily = FilterInput($_POST["Family"], 'int'); $iCheckNo = FilterInput($_POST["CheckNo"], 'int');