Praise be to Allah, and may Allah’s peace and blessings be upon the Messenger of Allah, his family and his companions.
Wa alaikum assalam wa rahmatullahi wa barakatuh.
As to what follows:
With regards to answering your question we say, success is by Allah Almighty.
The consensus among the scholars is that making intention for Prayer is compulsory and that Prayer cannot be convened except by it. This was said by many scholars. This originates from the saying of The prophet (peace be on him):
“The reward of deeds depends upon the intentions and every person will get the reward according to what he has intended.” [Bukhari and Muslim on the authority of Umar Ibn al-Khatab (may Allah be pleased with him)]
However the scholars differed into three opinions regarding this issue:
1st: it is permissible to make intention before the first takbir even if the time is prolonged between intention and Prayer as long as the intention is not disturbed by other things. This is Malik’s opinion. Ibn Abdul Barr said in al-Kafi (39):
“The opinion of Imam Malik is that if a person stands up for prayer, or goes to the mosque, he will be having the intention for that, even if he is not conscious of it. This will remain the case until he changes this intention to something else. What has been reported from Imam Ahmad (may Allah have mercy on him) is similar to this. He was asked about a person who goes out of his home on Friday and makes the intention to go for the Friday prayer. He said, "His going out of his house is an intention." He also said, "If a person goes out of his house for prayer, then his going out is an intention for prayer. Do you think that he makes takbeer (al-ihraam) without intending to perform prayer. After quoting what was transmitted from Ahmad, Shaykh al-Islam stated in al-Majmoo' al-Fatawa (22/229), " This is why the senior scholars of the mathab of Imam Ahmad like al-Khiraqi and others said, "It is sufficient for a person to have an intention which precedes takbeer al-ihram from the moment that the time for prayer starts."
2nd: It is permissible to make intention before the first takbir if the time in between is short so long as it is not terminated. This is the view held by Hanafites and Hanbalites scholars.
3rd: It is NOT permissible to make intention before the first takbir not only that but it should be made at the time of takbir. This is the opinion held by the Shafi school of thought. However this opinion has clear difficulties.
Ibn Hazim said: it is not permissible to separate the intention from takbir, nay but it should be connected without any break between them whether short or long.
The preponderate view in my own opinion is what is held by Malik and Ahmad which says that it is permissible to make intention before the first takbir even if the time is prolonged between intention and Prayer as long as the intention is not disturbed by other things or terminated.
The objective of intention is to distinguish an action from another and this is achieved by the first intention as long as it is not terminated or changed. This first intention is deemed valid as long as it is not terminated. Therefore if someone wonders about his intention or doubts it during Prayer, it does not affect the correctness of his Prayer. This is unanimously agreed upon. Shaykh Ibn Taymiyah mentioned this in Sharh al –Umdah (387). This saying supports the permissibility of making intention before the first takbir even if the time is prolonged between intention and Prayer. It is clear that this is the view preferred by Shaykh al –Islam Ibn Taymiyyah (may Allah have mercy on him)
And Allah knows best.