PHP: problems searching text in a file
<p>I think i was doing halfway good to get this to halfway work. Anyways the following code works to find it on the first line, but i have a script that creates each on an individual line.
Please revise or create a completely new version of the following to make it to search for the form data on every line.</p>

<pre><code>$search = $_POST['search'];
$file = file("SLIST.txt");
foreach($file as $line) 
{
    $line = trim($line);
    if($line == $search) 
    {
        echo $search . " WAS found in the database";
    }
    else 
    {
        echo $search . " was NOT found in the database";
    }
}
</code></pre>

<p>by form i mean there is a search form on the previous page. This page is the page where it tells you whether the text put into the search form matches a line in the file (ex: Line 1: BOOT Line 2: Tree Search entry: Tree  Echo msg: Tree WAS found in the database.)</p>

<p>It is currently not working like i intended.</p>
