Jump to content

Verify custom Fields


Clebson

Recommended Posts

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated