Constipated and bloated weight gain?

I've been dieting and lost a lot of weight. Lately, I have begun to bloat and get bad cramps. I couldn't poop either. I started eating more fiber like whole grain bread etc and now I have a bowel movement. But I'm gaining weight rather than losing it. Why is this?
Constipated and bloated weight gain?
Post Opinion