Here are the main snippets...
if($_POST['submit']){
$brand = $_POST['brand'];
$keyword = $_POST['keyword'];
if($brand !== ""){
$sql_wholesale = mysql_query("SELECT * FROM ".$prefix."store_temp WHERE brand='$brand' AND (item_name LIKE '%$keyword%' OR item_name LIKE '$keyword%' OR item_name LIKE '%$keyword')") or die(mysql_error());
while($s_f = mysql_fetch_array($sql_wholesale)){
$product = $s_f['product_id'];
$instock = $s_f['qty_avail'];
$instock -= 3;
$description = $s_f['description'];
$description = mysql_escape_string($description);
$brand = $s_f['brand'];
//some stuff here
mysql_query("INSERT INTO ".$prefix."store_inventory (product, quantity, description, image, price, title, cat_id, popularity, sale_price, ship_price, instock, brand, msrp, other_cat) VALUES ('$product', '1', '$description', '$image', '$price', '$title', '$cat_id', '$popularity', '$sale_price', '$ship_price', '$instock', '$brand', '$msrp', '$sec_cat_value')");
if(!mysql_error()){
echo "<center><b>".$title." was entered into the database. ";
echo "</b></center><br />";
} else { echo "<center><b>MySQL said: ".mysql_error()."</b></center><br />"; }
}//end if brand !== ""
}//end while
}
//there is just a form down here with a few input fields.