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.