The World Federation One Stop Fiqh

Ruling 744

If a person becomes certain during the ʿaṣr prayer that he has not performed the ẓuhr prayer and he changes his intention to the ẓuhr prayer, in the event that he remembers that he has actually performed the ẓuhr prayer, he can revert his intention to the ʿaṣr prayer and complete the prayer provided that he has not performed any obligatory components of the prayer with the intention of the ẓuhr prayer; if he has, he must perform them again with the intention of the ʿaṣr prayer. However, if the act is an obligatory component of the rakʿah, his prayer in both cases is invalid. Similarly, if the act is a rukūʿ, or two sajdahs in one rakʿah, then based on obligatory precaution his prayer is invalid.