Excess phlegm with cough which has never happened to me before. How do I stop this?

Diagnosis first... Before this cough can be treated, the cause needs to be diagnosed. Possibilities include acute bronchitis from an infection of the airways, chronic bronchitis, a form of copd, bronchospasm with airway inflammation, post-nasal drip or a combination of factors. The treatments for these are all different so you need to see your doctor so your cough can be diagnosed and treated.