Can anyone walk me through this code PLEASE
<html>
<head>
<title>Search Results</title>
<style type="text/css">
<!--
.style1 {
font-family: "Times New Roman", Times, serif;
font-style: italic;
color: #990000;
}
-->
</style>
</head>
<body>
<h2 class="style1">Search Results</h2>
<?php
// create short variable names
$searchtype=$_POST['searchtype'];
$searchterm=$_POST['searchterm'];
$searchterm= trim($searchterm);
if (!$searchtype || !$searchterm)
{
echo 'You have not entered search details. Please go back and try again.';
exit;
}
if (!get_magic_quotes_gpc())
{
$searchtype = addslashes($searchtype);
$searchterm = addslashes($searchterm);
}
$connect = mysql_connect("localhost", "root", "")
or die(mysql_error());
//make our database active
mysql_select_db("shop");
$query = "select * from products where ".$searchtype." like '%".$searchterm."%'";
$results = mysql_query($query)
or die(mysql_error());
$rows = mysql_num_rows($results);
echo '<p>Number of products found: '.$rows.'</p>';
for ($i=0; $i <$rows; $i++)
{
$row = mysql_fetch_array($results);
if (@file_exists('images1/smallImages/'.$row['productid'].'.jpg'))
{
$product_image = '<img src=\'images1/smallImages/'.($row['productid']).'.jpg\' border=1 />'; // gets the product image from the product ID chosen
}
echo $product_image;
echo '</p>';
echo '<p><strong>'.($i+1).'. Name: ';
echo htmlspecialchars(stripslashes($row['product_name']));
echo '</strong><br />description: ';
echo stripslashes($row['product_desc']);
echo '<br />productid: ';
echo stripslashes($row['productid']);
echo '<br />Price: ';
echo stripslashes($row['product_price']);
echo '</p>';
}
?>
</body>
</html>