However, we should clarify here two important points in order for you to be able to explain in details:
-Prostration of thankfulness
-Salatul-Hajah
The prostration of thankfulness or Sajdat al-Shukr “is prescribed for anything that makes one happy, whether it is attaining some benefit or warding off some harm. The evidence for this is to be found in many of the Prophetic Hadiths. Abu Bakrah (may Allah be pleased with him), said that when the Prophet (peace and blessings of Allah be upon him) heard any news that made him glad, he would fall down prostrating to Allah, may He be exalted. (Reported by the five except al-Nisa’i)”
It is clear from the above when one aught to perform Sajdat al-Shukr keeping in mind that Sajdat al-Shukr can be performed while one is not praying as it is clear from the Prophetic Hadith mentioned above.
As for the issue of Salatul-Hajah, we would like to cite for the following issued by Dr. `Ujail Jasim An-Nashami, professor of Shari`ah at the University of Kuwait, in which he states:
“All Muslim scholars agree that Salatul-Hajah is a recommended act of worship. They base their view on the hadith, which is reported on the authority of `Abdullah Ibn Abi Awfa (may Allah be pleased with him) that the Messenger of Allah (peace and blessings be upon him, said: “If any one among you has any kind of need, be of Allah or of a human being, let him perform wudu’ (ablution) and offer two rak`ahs (prayer units). Then he should praise Allah, invoke His blessings on the Prophet (peace and blessings be upon him) and say the following du`a’ (supplication):
La ilaha illa Allahu-Haleemu lkareem. Subhana Allahi rabi el-`arshil `azeem. Al-Hamdulilahi rabbi il-`Alameen. As’aluka mujibati rahmatika, wa `aza’ima maghfiratika, wal-`ismata min kuli dhanb, wal ghaneemata min kuli birr, was-salamata min kuli ithm. La tada` li dhanban illa ghafartahu, wala hamman illa farajtahu, wala hajatan hiya laka ridan illa qadaytaha ya arhama ar-rahimeen.
(There is no god but Allah, the Ever-Clement, the Most Generous. I celebrate the Glory of Allah, the Lord of the Magnificent Throne. All praise and thanks are due to Allah, Lord of the worlds. I beseech you, seeking that which will draw me closer to Your mercy, and that which will make certain for me Your Forgiveness. O Allah, grant me protection against any sin, and a share of every virtue. Do not leave me a sin without forgiving it, a worry without relieving me of it, or a need that meets with Your pleasure without providing for it, O Most Merciful Lord.)
As for the number of rak`ahs in this prayer, scholars hold different views. The Malikis, Hanbalis, Ash-Shafi`is – in the famous view – and some Hanafis say that it consists of two rak`ahs. Some other Hanafis say that it consists of four rak`ahs and others say that it is a twelve-rak`ah prayer.”