MySQL/PHP Search Engine
<p>I have a tutorial search engine script, The HTML Form is</p>

<pre><code>    &lt;h2&gt;Search&lt;/h2&gt; 
 &lt;form name="search" method="post" action="&lt;?=$PHP_SELF?&gt;"&gt;

 First Name:&lt;input type="text" size="12" maxlength="12" name="find"&gt;:&lt;br /&gt;
 Last Name: &lt;input type="text" size="12" maxlength="12" name="f"&gt;:&lt;br /&gt;
 &lt;Select NAME="field"&gt;
 &lt;Option VALUE="fname"&gt;First Name&lt;/option&gt;
 &lt;Option VALUE="lname"&gt;Last Name&lt;/option&gt;
 &lt;Option VALUE="info"&gt;Profile&lt;/option&gt;
 &lt;/Select&gt;
 &lt;input type="hidden" name="searching" value="yes" /&gt;
 &lt;input type="submit" name="search" value="Search" /&gt;
 &lt;/form&gt;
</code></pre>

<p>The PHP Script is:</p>

<pre><code> &lt;? 
     //This is only displayed if they have submitted the form 
     if ($searching =="yes") 
     { 
     echo "&lt;h2&gt;Results&lt;/h2&gt;&lt;p&gt;"; 

     //If they did not enter a search term we give them an error 
     if ($find == "") 
     if ($f == "") 
     { 
     echo "&lt;p&gt;You forgot to enter a search term"; 
     exit; 
     } 

     // Otherwise we connect to our Database 
     mysql_connect() or die(mysql_error()); 
     mysql_select_db("") or die(mysql_error()); 

     // We preform a bit of filtering 
     $find = strtoupper($find); 
     $find = strip_tags($find); 
     $find = trim ($find); 
     $f = strtoupper($f); 
     $f = strip_tags($f); 
     $f = trim ($f); 

     //Now we search for our search term, in the field the user specified 
    $data = mysql_query("SELECT * FROM users WHERE upper($field) LIKE'%$find%'");


     //And we display the results 
     while($result = mysql_fetch_array( $data ))
     { 
     echo $result['fname']; 
     echo " "; 
     echo $result['lname']; 
     echo "&lt;br&gt;"; 
     echo $result['info']; 
     echo "&lt;br&gt;"; 
     echo "&lt;br&gt;"; 
     } 
     //This counts the number or results - and if there wasn't any it gives them a little message explaining that 
     $anymatches=mysql_num_rows($data); 
     if ($anymatches == 0) 
     { 
     echo "Sorry, but we can not find an entry to match your query&lt;br&gt;&lt;br&gt;"; 
     } 

     //And we remind them what they searched for 
     echo "&lt;b&gt;Searched For:&lt;/b&gt; " .$find; 

     } 
     ?&gt; 
</code></pre>

<p>I am trying to filter out the Fname, Lname, and Info using Input Type = text
I don't want the Dropdown Select Menu, I have tried and searched for documentation on this tutorial, unfortunatly I haven't found squat. </p>

<p>What I want is to be able to search Fname, Lname and Info seperately in one form, and I tried adding another Search Term, "$f", and an input type with the name of "f", I can get it to display the results, yet when I try to search in the "Last Name" field, ($f), It displays everything from my database, I would so appreciate it if someone could help me out, this is for a website for people directory search, I told the guy that 1 search bar would be great, it's easier, yet he insists that seperate unique fields would be, "Idiot Proof", yet, HOW DID YOU GET TO THIS WEBSITE? if you don't know how to enter in an input field. Thanks</p>

<p>P.s. Example of what I am wanting to accomplish, whitepages.com
What the problem is now, 411cells.com/search.php (try to type jim in the last name field see what I am talking about!)</p>
