In thinking about this - it sounds as if your cat may have a colitis.
Here is a great link that talks about colitis http://www.petplace.com/cats/colitis-in-cats/page1.aspx
These signs can be from many different causes including eating something abnormal and even certain types of infections including intestinal parasites, giardia, and coccidia
The best way to tell what is the cause would be to have your veterinarian do an examination and perform some tests, initially looking at the feces, testing for some of these infectious causes like parasites and protozoa.
If there is no cause and this is a non-specific colitis, your veterinarian may prescribe an antibiotic called Metronidazole which is a great medication for non specific cases of colitis similar to this.
At home you may wish to try 1 tablspoon of a fiber source such as bran or metamucil in the food
every 24 hours to help with the form of the stool.
You can give 2.5mg of over the counter Pepcid A/C once per day for stomach upset.
You can also apply a small amount of Desitin ointment or A&D ointment on ther anus for comfort.
I hope this information helps!
_____________________________________________________________________Please click "ACCEPT" if the information I have provided has been of help so I receive credit for my work. Bonuses are always welcome and appreciated. Thank you. The above is given for information only. Although I am a licensed veterinarian, I cannot legally prescribe medicines or diagnose your pet's condition without performing a physical exam. If you have concerns about your pet I would highly advise contacting your regular veterinarian