If you are in danger, pray on foot or while riding; and when you are safe, remember Allah in the manner that He has taught you which you did not know before.