Clebson Posted June 23, 2013 Share Posted June 23, 2013 Good afternoon everyone! Does anyone know a way to check if there is already a record for the custom fields for a new account in the client area? I created a script here, it works perfectly out of WHMCS, I could not make it work in the whmcs templates. file: [b]connectdb.php [/b] <?php header("Content-Type: text/html; charset=ISO-8859-1"); $db_host = 'localhost'; $db_username = 'db_username'; $db_password = 'db_password'; $db_name = 'db_name'; $con = mysql_connect($db_host, $db_username, $db_password); mysql_select_db($db_name, $con); $sql = " SELECT * FROM `tblcustomfieldsvalues` WHERE `value` = '{$_POST['value']}' "; $q = mysql_query( $sql );//exec if( mysql_num_rows( $q ) > 0 )//error echo 'Sorry! The value informaod already exists.'; else echo '.'; ?> file: [b]index.html[/b] <script type="text/javascript"> $(function(){ $(".value").blur( function(){ var value = $(".value").val(); $.post('connectdb.php',{value: value},function(data){ if( data!='.' ){ alert(data); $(".value").val('');} jAlert('Text'Title'); });});}); </script> <form method="post"> <label>VAT: <input type="text" id="value" /></label> </form> Does anyone know any other way to do this? Thx. 0 Quote Link to comment Share on other sites More sharing options...
jclarke Posted June 24, 2013 Share Posted June 24, 2013 If this is a client custom field you could create a ClientDetailsValidation hook to do this. http://docs.whmcs.com/Hooks:Clients#ClientDetailsValidation 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.