What if your husband had surgery on his testicles and the doctor told him he can't have kids is that true?

Well, if the doctor say's so, yes... It depends what surgery he has had. If his testicles have been removed he will certainly be infertile. Many men though who have had cancer surgery and chemotherapy and radiotherapy have (against the odds) become fertile again and fathered children. Probably the best thing to do is to plan as though he is infertile and if it turns out his fertility returns take that as a bonus.