using MySQLi Check New Username to check for a duplicate license number
In my admin section, I would like to use the License Number field to check for duplicates. The issue is it needs to be done before they enter all the other data as there are tons of fields to enter.
I tried using the Check New Username SB. Created a button next to the Lic# form field entry point. Used that button as the trigger point, used the licensenumber field in the Form as the value. Also tried using the licensenumber in the WA_ValidatedEntries when the first didnt work.
Is there any chance this could work. Right now when I click the DupeCheck button it just goes to the next field..
Here is the code it generated.
<?php
if (isset($_POST["dupeCheck"]) || isset($_POST["dupeCheck_x"])) {
$CheckNew = new WA_MySQLi_Auth($conn_mdb1);
$CheckNew->Action = "checknew";
$CheckNew->Table = "maintbl";
$CheckNew->addFilter("licenseNumber", "=", "s", "".((isset($_POST["licenseNumber"]))?$_POST["licenseNumber"]:"") ."");
$FailedRedirect = "switch.php";
if (function_exists("rel2abs")) $FailedRedirect = $FailedRedirect?rel2abs($FailedRedirect,dirname(__FILE__)):"";
$CheckNew->FailRedirect = $FailedRedirect;
$CheckNew->execute();
}
?>
Thanks.