JavaScript is a client-side language. It looks like you're trying to retrieve a value from it through PHP, which will never happen. PHP will be long-executed before JavaScript even comes in to play.
You need to either submit the value to PHP through a form, or use something like an AJAX call and send PHP the value so it can process it after the page has been loaded.
In your case, AJAX appears to be a better option. In which case something like the following should work:
$.getJSON('verify_email.php',{email:frm.add_fd2.value},function(data){
if (data.matches>0){
// matches were found
}else{
// no matches found
}
});
then in verify_email.php:
<?php
// ... establish connection ...
$email = mysql_real_escape_string($_GET['email']); // note, this should be checked for existance
$result = mysql_query("SELECT * FROM table WHERE email='{$email}'");
header('Content-Type: application/json');
echo '{matches:'.mysql_num_rows($result).'}';
?>
Or something of that sort. (Note I'm using jQuery to make this syntactically easier).