I need to type in input , it checks the database if there is an equal record, such as those fields of user creation in email.
I think it's in onBlur
of input , and using if ==
in the command, the problem is: how do I call SQL values for comparison?
No search button, it has to be when typing (onblur).
input is limited to 7 characters.
<input name="placa" id="placa" type="text" value="" pattern="[A-Za-z]{3}[0-9]{4}" size="20" maxlength="7" required onkeyup="this.value = this.value.toUpperCase();" onblur="verifExists(digs)">
DIV hidden after input
<div class="style12" id="jaexistedv" style="display:none">Placa já registrada!</div>
PHP + Java
$search_buscar = "-1";
if (isset($_GET['placa'])) {
$search_buscar = (get_magic_quotes_gpc()) ? $_GET['placa'] : addslashes($_GET['placa']);
}
mysql_select_db($database_LocalPHP, $LocalPHP);
$query_buscar = sprintf("SELECT * FROM bdsul WHERE bdsul.placa LIKE '%s'", $search_buscar);
$buscar = mysql_query($query_buscar, $LocalPHP) or die(mysql_error());
$row_buscar = mysql_fetch_assoc($buscar);
$totalRows_buscar = mysql_num_rows($buscar);
<script type="application/javascript">
function verifExists(digs) {
var regpl = <?php echo $row_buscar['placa']; ?>;
if (digs == regpl) {
document.getElementById("jaexistedv").style = "display:show";
}
}
</script>