While I was leading about ten persons in the Maghrib (sunset) prayer, I remembered that I did not pray the ‘Asr (the afternoon prayer). I was doubtful during the prayer whether I had prayed ‘Asr or not and then became almost certain of not praying it at the end of the prayer. After the end of prayer, I asked those who were praying behind me whether anyone of them had seen me praying the ‘Asr prayer and they said that they had not. Then I asked my wife the same question and she said no. This made me certain that I had not prayed the ‘Asr. What is the Sharee‘ah ruling on the Maghrib prayer for me and for those who prayed behind me as well? What should I do in such a case? Am I guilty if those who prayed behind me did not make up the prayer?
All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and Messenger.
The scholars provided different opinions regarding a person who remembers a missed prayer while praying a present one. The Hanbali scholars are of the opinion that such a person should complete his prayer provided that there is sufficient time to make up the missed prayer and then repeat the present prayer in order to maintain sequence, which is obligatory from their viewpoint. The Maaliki scholars are of the opinion that such a person has to end the prayer, whether he is an Imaam or praying alone. However, when he violates sequence and continues in prayer, his prayer is valid, as they (the Maaliki scholars) do not consider maintaining sequence a condition. Then it is recommended for him to repeat the prayer as long as it is the part of the time of the prayer when one is not required to immediately pray. As for the ruling on the prayer of those praying behind him, the scholars provided two different opinions. The preponderant opinion, however, is that they are not required to make up the prayer, as the Imaam's prayer was perfect in itself. This is the opinion of Taawoos, Al-Hasan, Ash-Shaafi‘i and Abu Thawr .
Consequently, the questioner's prayer is valid as well as that of those who prayed behind him.
You can search for fatwa through many choices