Praise be to Allah.
This is a serious mistake and it is not permissible to do that. Therefore the prayer is not valid. You have to wash all of your body, including the hair, as stated in the hadeeth of Umm Salamah (may Allaah be pleased with he) who said: “I said, ‘O Messenger of Allaah, I am a woman who braids her hair – should I undo it to do ghusl for janaabah?’ He said, ‘No, it is sufficient for you to pour water over your head three times.’” (Narrated by Muslim, no. 330). If your hair is braided then you can wash it and make sure that the water reaches the roots as well was washing the rest of it. This is essential. Your prayers are not valid because you did not do ghusl from janaabah properly. One of the conditions of ghusl from janaabah is that water should reach every part of the body, including the hair. The same applies to ghusl following menstruation or post-natal bleeding.
You have to repeat the prayers which you prayed when you had not washed your hair when doing ghusl following janaabah or menstruation. And Allaah knows best.