It is a valid marriage from the point of view of having met the necessary conditions, but it goes against the Islamic command to publicize the marriage. Not having the marriage officially documented may lead to the wife losing out on her rights with regard to the dowry and inheritance, and if the marriage leads to children, how will this child be recorded in official documents?
Some scholars say that publicizing marriage is one of the conditions for it to be valid. They gave the reason for that the fact that publicizing the marriage demonstrates the difference between marriage and immoral relationships.
It is narrated that the Prophet (peace and blessings of Allah be upon him) said: “The difference between what is considered an intact marriage and what is not, is beating the daff and raising the voice at weddings.” Narrated by al-Tirmidhi, 1088; al-Nasaa’i, 3369; Ibn Maajah, 1896.