View Single Post
ישן 10-10-10, 19:49   # 6
dvs52
חבר חדש
 
מיני פרופיל
תאריך הצטרפות: Apr 2007
הודעות: 25

dvs52 לא מחובר  

אתה יכול ליצור קובץ PHP שהשם שלו זה file.php ושזה יהיה התוכן שלו: (אני מקווה שזה יעזור לך ושלזה התכוונת)
PHP קוד:
<?php
if (isset($_POST['username']))
{
  
$query mysql_query("SELECT username FROM members WHERE username='{$_POST['name']}'");
  if (
mysql_num_rows($query) > 0)
  {
    echo 
"you can't use this username";
  }
  else
  {
    echo 
"you can use this username";
  }
}
else
{
?>
<form>
select a username: <input type="text" name="username" id="my_username"><span id="result"></span>
<br>
<button type="submit" name="submit">check</button>
</form>
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script>
$("#my_username").blur(function() {
  $.post("file.php", {username: $(this).val()}, function(data) {
    $("#result").html(data);
  });
});
</script>
<?php
}
?>
  Reply With Quote