His prayer is invalidated whether he did it intentionally or forgetfully. See: Al-Bahr 2: 8-9, Fath Bab Al-Inayah 1: 301, Radd Al-Muhtar 1: 414.
If the previous answers are not appropriate, please send your question to the Mufti via