Poor baby. There are so many reasons why a cat can get diarrhea - it's the body's way of ridding itself of some toxic substance. Has your cat had problems before with pooping outside the box, or is this the first time? Is it just that he can't make it to the litterbox? You might want to keep him confined to one room with a couple of boxes until he's feeling better.
If your cat wants to eat, you can give him some plain baby food - use poultry flavors, they're easier to digest. Make sure there is NO onion powder in the food. Baby food contains no fiber, so it's very binding. Feed small amounts, not the size of a regular meal.
Plain, skinless roasted or boiled chicken breast, pureed with some white rice is also binding. Bland food is best when a cat is suffering with diarrhea.
Interestingly, according to Anitra Frazier, in her book "The New Natural Cat", extreme dehydration can (ironically) also produce diarrhea. She comments that it will clear up after the cat is hydrated. Diarrhea itself can be very dehydrating, so make sure your cat is drinking water. If he isn't you should gently syringe water into his mouth (down the sides, not straight down the middle). Frazier recommends withholding all solid food, and feeding only chicken broth (High Calcium Chicken broth, her own recipe).
Hope your kitty will feel better soon.