Assalamualaikum, I was praying and I felt the need to sneeze but I stopped myself from sneezing (I know I shouldn't have done that) and I said AlHamdulilah, is my prayer valid? Because I didn't sneeze, I said AlHamdulilah in prostration and from my knowledge it is permissible to say that in prostration correct me if I am wrong
All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
Saying “Praise be to Allah” (Al-Hamdu Lillah) during prostration does not invalidate your prayer, because praising Allah, The Exalted, during prostration, has been proven from the Prophet .
It was reported that'Aaishah said: “One night I missed the Messenger of Allah from his bed. When I looked, he was in bowing or prostrating posture and was reciting: Subhaanaka wa bi hamdika. La ilaaha illa Anta (You are free from imperfection and I praise You. There is no true god except You).” [Muslim and others].
As for holding in a sneeze, despite the need for it, is contrary to what is healthy, because there are great benefits in sneezing, which Ibn al-Qayyim speaks about in Zad al-Ma’ad:
“And since the sneezer acquires a blessing and a benefit from sneezing through the release of the vapors congested in his brain, which, if they remained in him, would cause him severe ailments, It was prescribed for him to praise Allah (say Al-Hamdu lillah) for this blessing...”
Allah knows best.
You can search for fatwa through many choices