Thanks for posting your query.
These symptoms are very typical of an inflamed rectum.
test and a stool test
may be done.
You may need a course of antibiotics if it is due to infection.
There are other causes as well like IBD which can be diagnosed with sigmoidoscopy/colonoscopy