This is my search engine code, i think my code have some problem and mistake so that i cannot get the proper searching. Can anybody kelp me to correct it?
<form name="search" method="post" action="<?=$PHP_SELF?>">
Search for:
<br><input type="text" name="search">
<br><Select NAME="field">
<Option VALUE="Operation">Operation</option>
<Option VALUE="office">office</option>
<Option VALUE="comunication">comunication</option>
</select>
<br><input type="submit"name="Submit"value="Submit"/>
</form>
<?
//required file for database connection
require("config.php");
if (isset($POST['search'])) {
$search = mysql_real_escape_string($POST["search"]);
//$field=mysql_real_escape_string($_POST["field"]);
echo "<h2>Results</h2><p>";
//If they did not enter a search term we give them an error
if ($search== "") {
echo "<p>You forgot to enter a search term";
exit;
}
//Now we search for our search term, in the field the user specified
$data = mysql_query("SELECT * FROM listofitem WHERE Name LIKE '%$search%'or UPPER($field) LIKE '%$search%'");
echo "<tr><td bgcolor='#CCCCFF'>ID</th><td bgcolor='#CCCCFF'>Nama</th><td bgcolor='#CCCCFF'>Brand</td> </tr>";
//And we display the results
while($result = mysql_fetch_array( $data ))
{
echo "<tr><td><a href='InformationPage.php?id={$result['ID']}'>{$result['ID']}</a></td>
<td><a href='InformationPage.php?id={$result['Name']}'>{$result['Name']} </td>
<td>{$result['Brand']}</td>
</tr>";
}