Process your $_POST and do some switch function to see what type the user selected and set your $search_type
$result=$db->query("SELECT PCBrand, LBrand, PCLAPTOP, ONLINEHIGHSTREET, Retailer, Address, Address_2, Town, County, Postcode, Postcode_code, Phone, Website FROM
database WHERE PCLAPTOP LIKE 'type' AND " .$search_type. " LIKE '%$searchterm%'");
If this is wrong i might have understood your question wrong.
Hi, actually i think you are spot on - thanks. I wasn't aware of switch functions but that seems to be what i'm after.
I am going to try to work it out - so far i have tried the following code but it is nt working.
$result=$db->query("SELECT PCBrand, LBrand, PCLAPTOP, ONLINEHIGHSTREET, Retailer, Address, Address_2, Town, County, Postcode, Postcode_code, Phone, Website FROM
database WHERE PCLAPTOP LIKE 'type' AND switch ($type){
case "LAPTOP":
echo "LBrand";
break;
case "PC":
echo "PCBrand";
break;
case "both":
echo "PCLAPTOP";
break;
}
LIKE '%$searchterm%'");
I think your suggestion is to create a search_type that takes type and changes to names of fields - is this what you mean? I am going to try and do that - thanks for you help - much appreciated