In php.ini, set
error_reporting = E_ALL
log_errors = /path/to/logfile
You may need to restart your webserver afterwards, but from that point on you will get errors and warnings in a log file. They might tell you something.
Apart from that, when posting code, always indent it properly and wrap it in appropriate tags: html tags for html code, php tags for php code, code tags for other languages.
All functions starting with ereg are deprecated, but since you are doing completely pointless things with it, you might as well remove it rather than replace it with preg.
$fname = $_POST['fname'];
/* Remove these lines below... */
$fname = stripslashes($fname);
$fname = strip_tags($fname);
$fname = eregi_replace("`", "", $fname);
/* ... remove these lines above */
$fname = mysql_real_escape_string($fname);
Since you are using mysql_real_escape string, the input will not be able to harm you. There is 0 chance of sql injection here. The other functions don't give you any safety in this regard, and since you allready get 100% safety allready, they would still be pointless even if they did help.
What they do, however, is change the user's input, so that the database is searched for something other than the user specified. This is a bad thing. For example, let's say you one day allow searching for usernames, rather than just first and last real names, and that usernames allow other characters than real names do. You then risk having "unsearchable" usernames, since you silently change user input.
What you ought to do instead, if anything at all, is check the input string for invalid characters and inform the user so that they can make the corrections themselves.
You will also never manage to get any results back from the database when serching for "John Doe", unless of course someone has either "John Doe" as first name or "John Doe" as last name. But I would suspect they have John as first and Doe as last name.