Although you still need to fix the underlying problems of why your cat isn't going where he should, some medications may help in the short-run. Talk to your veterinarian. The first step in getting your cat to use the litter box is to figure out why he's not using it. Your cat may come to associate the use of the box with these unpleasant sensations, and so avoids the box. If your cat checks out fine, you need to experiment to make sure that everything about the box is to his liking.
Cats are fastidious animals, and if the litter box is dirty, they look elsewhere for a place to go.
Box type and filler. Many choices people make to suit their own tastes don't match with what their cat wants, and when you're talking boxes and litter, your cat's opinion is the only one that really counts. Many times the offending box or litter is one chosen in an attempt to reduce smell for people - but your cat can still smell just fine. A covered box may seem more pleasing to you, but your cat may think it's pretty rank inside. Many cats prefer clumping litter, and this variety makes the box easier to keep clean, too.