When you get a stomachache, it might be an actual problem right in your stomach, but not necessarily. The problem could be in your abdomen. Your abdomen is more than your stomach and more than your intestines. It's the whole area between your chest and your hipbones.
Peritonitis is when the tissue that covers the inside wall of the abdomen gets swollen and irritated, usually due to an infection. Appendicitis can cause peritonitis if it isn't treated before the appendix bursts.