Hello. Thank you for coming to JustAnswer with your question, and welcome.
I need more information to clarify your problem:
---What type of rectal surgery did you have?
---And what has changed about your bowel habits?
Do you have diarrhea most of the time, or very loose stools?
You might try a soluble fiber supplement to give more bulk to your stools without causing constipation. There are many to choose from at your local drug store or pharmacy. Some common brands would be Benefiber, Metamucil, etc. Fiber can be used for both loose stools (take it with LESS water than recommended); or for constipation (take it with MORE water than recommended).
Additionally, since broccoli causes diarrhea for you, put this on the "list" of foods you should start to keep, of foods to avoid. Everyone is different, but other foods that may also cause problems for you are corn, beans, and cabbage. You will just have to try them and see.
If you eat something that you know will cause you a problem, follow it with a dose of the fiber supplement. This may help.
Unfortunately, everyone's digestive tract and their tolerances/intolerances or allergies to foods are different. So, basically you will have to find out what is good for you with trial and error.
Foods that can tend to firm stools in most people would be cheese, bananas, white rice, white bread. Avoid anything with high amounts of fat, since this tends to cause diarrhea in people prone to loose stools. Some other good foods would be chicken with skin removed; white potatoes; cooked carrots and onions.
Start a food diary, and take note of foods that work for you; and those that don't. Just start writing down everything you eat daily, and see what happens the next day. Eventually, you will have a good list of what is good and what is not.