Answered by Shaykh Faraz Rabbani
What is the ruling regarding swallowing phlegm, accidentally or otherwise while fasting? Can you please give an example as well?
Swallowing phlegm from within the mouth does not invalidate the fast in the Hanafi school, even if done intentionally. [Shurunbulali, Maraqi]
However, it is recommended to avoid swallowing phlegm, [ibid.] in a dignified manner, when reasonably possible.