During flu season, and many who have painful conditions or injuries find that their pain gets worse, and sometimes other parts of the body can feel sore. This is because the immune system supports and monitors the nervous system, and can increase the sensitivity of nociceptors (danger sensing nerves) when pathogens are detected. This makes sense in some ways, if your immune system recognises a threat, you want your protection system to be working really well. Add to this that your abdominal muscles are repetitively contracting as you cough or sneeze, which increases compression of the spinal joints and can make them more inflamed and sensitive.
Preventative measures such as the flu vaccine, ensuring plenty of sleep and great nutrition (fresh foods, varied diet) are the best way of avoiding this painful circumstance.
If you do have a sore throat or a cough the most effective remedies are salt water gargles or lemon/honey drinks, and steam (either hot shower or sitting over a bowl full of boiling water). These soothe and hydrate the inflamed lung and throat tissues and reduce coughing, therefore reducing the neck and back pain.