Question: why do you get a headache when you sleep with wet hair?
Answer: Fungal diseases or scalp infections require contact with contaminated sources, so unless your pillowcase has fungus growth, you won't have fungus growing in your hair just because you slept with wet hair. There is also no scientific evidence that links headaches to sleeping with wet hair.