As others have said your options from Bath to LHR are as follows:
- Rail from Bath to Paddington and then Heathrow Express train from there to LHR.
- National Express coach service (403) to LHR.
- Rail from Bath to Reading and then the airport bus to LHR.
From Salisbury it is more complicated. Rail services go into Waterloo, so you'd then need to get to Paddington to pick up the Heathrow Express train to the airport. You can do this by tube, by taking the Bakerloo line. Or you can get to Heathrow by tube, by taking the Jubilee line from Waterloo to Green Park and then changing to the Piccadilly line to Heathrow. Alternatively you could take the National Express coach service (033) directly to the airport.
I am not sure on cost - you'd need to check by looking up the exact dates and times you want to travel. Time is likely to be similar, but the National Express services are direct and would mean less hauling of bags.