Hi, sorry for the delay in replying. White foamy substance in the stool or mucus in the stool can be due to
over production of mucus in the large intestine. It may occur due to pancreatitis, pancreatic cancer; liver or
bile duct disease; crohn's disease, celiac disease, food poisoning ,tuberculosis; candida overgrowth in
the large intestine; on taking antacids etc. You should get a stool test, liver function test and test for
pancreatic enzymes, done for diagnosis. Get in touch with a Pediatric Gastroenterologist. Take care.