I had a question regarding wajib Namaz. If I forget in what rakat i was in namaz, can I simply change the wajib niyyat into mustahab and complete the salah? For example praying zuhr, and in the 2nd Rakat I forget what rakat so I simply change niyyat into fajr qaza or 2 rakat shukarana and finsih the prayer in 2 rakat

You must follow the rulings of doubts.