jquery ajax rekor db varsa doğrulamak için nasıl

0 Cevap php

using jquery ajax i have a text field where a name is entered how can i have it where when a user enters a name ajax checks to see if the name already exists in the db and if it does a message is displayed that this name already exists and the form cannot be submitted until a name is entered that does not exist?

Bu php olurdu

<?php
$name = $security->secure($_POST['name']) //security->secure() cleans the field
$query = $db->query("select name from table where name = '$name'");
if($db->num_rows($query) != 0) { "that record already exists"; }
//disable the form button until a name is entered that does not exist.
?>

0 Cevap