Set Focus if Email id Exists
Dear All
Writing a program for membership registration.
If a member is already registered , i want JQUERY to display 'Member already exists
- <tr class="text12bgf3">
- <td height="26" class="text12bgf3" align="left"><span class="textblue">Email</span></td>
- <td class="text12black"><span class="textblue">:</span></td>
- <td align="left" class="text12"><span class="textblue">
- </span>
- <table width="100%" border="0" cellspacing="1" cellpadding="0">
- <tr>
- <td width="40%"><span class="textblue">
- <input name="email" type="text" class="contact" id="email" value="<?php echo $_POST['email'];?>" size="25" />
-
- </span></td>
- <td width="60%"><div id="emaildiv" style="display:none; background-color:#CCC" class="text14orange" > </div></td>
- </tr>
and JQUERY
$(document).ready(function(){
$("#email").blur(function () {
$('#emaildiv').show(1000);
var url = "emailcheck.php"
var data = {
id: $('#email').val()
};
$('#emaildiv').load(url, data);
$("email").focus();
});
I want to focus back to email if the email already exists.
At present JQUERY works ok and displays 'Eail id exists" in case the user enters email id
However in this case i want to set focus back to field email
$("email").focus();
I want conditional focus
emailcheck.php checks the existance of email id
- include("includes/dbconnect.php");
- include_once("includes/functions.inc.php");
- $id=$_REQUEST['id'];
-
- $query= sprintf("select * FROM member where email='%s' ", $id);
- // echo $query;
- mysql_select_db($database_DBconnect, $DBconnect);
- $Result = mysql_query($query , $DBconnect) or die(mysql_error());
-
- $rows = mysql_fetch_assoc($Result);
- $totalrows=mysql_num_rows($Result);
- //echo $totalrows;
- if ($totalrows > 0 )
- { echo "User already Registered : Choose another email id"; }