Dear Sir,
I suspect that everyone has experienced what you are experiencing and have probably asked the same question as you have at some stage in their life.
Fever usually indicates that there is an infection. Thick phlegm is usually made up of mucus and inflammatory exudates. While any inflamed mucosal lining (nose, sinus, throat, and lower airways) may produce phlegm during inflammation and infection, the quantity and location of what is seen in the picture suggests that it comes from the nose, sinus, and nasopharynx (the uppermost part of the throat where there is adenoidal tissue). The proportions may vary according to the main site of infection and the duration of the illness (i.e. whether it is acute or chronic).