Praise be to Allah.
What you did is not correct, because standing when one is able to do so is an essential part of the prayer. You could pray in the mosque, in the men’s room, after the men have left. If you cannot find a mosque then you can pray on the ground in any place.
Praying in cars, planes, trains or other means of conveyance, where one cannot face the qiblah or pray standing, is not permissible in the case of obligatory prayers unless two conditions are met:
1 – There should be the fear that the time for the obligatory prayer will end before reaching your destination. But if you will reach your destination before the time for prayer is over, you should wait until you get there to pray.
2 – It should not be possible to get off and pray on the ground. If it is possible to do so then you must do that.
If these two conditions are met, then it is permissible to pray in the vehicle. The evidence for it being permissible to pray in this case is the general meaning of the verses in which Allaah says (interpretation of the meaning):
“Allaah burdens not a person beyond his scope”
“So keep your duty to Allaah and fear Him as much as you can”
“and [Allaah] has not laid upon you in religion any hardship”
If it is said, If I am allowed to pray in these vehicles, should I face the qiblah and should I pray sitting even though I am able to stand? The answer is:
If you are able to face the qiblah throughout the prayer, then you must do that, because it is a condition of an obligatory prayer being valid whether one is travelling or not. See Question no. 10945.
If it is not possible to face the qiblah throughout the prayer, then fear Allaah as much as you can and do your best, because of the evidence narrated above.
This has to do with obligatory prayers. With regard to supererogatory (naafil) prayers, the matter is more relaxed; it is permissible for the Muslim to pray in the vehicles mentioned no matter what direction they are facing, even if he could get down on the ground at some times, because the Prophet (peace and blessings of Allaah be upon him) used to pray naafil prayers on his mount no matter what direction it was facing. Jaabir narrated that the Prophet (peace and blessings of Allaah be upon him) “used to pray voluntary prayers when he was riding without facing the qiblah.” (Narrated by al-Bukhaari, 1094). But it is better to face the qiblah when starting to pray a naafil prayer, if that is possible when travelling.
See Fataawa al-Lajnah al-Daa’imah, 8/124
With regard to offering obligatory prayers sitting down when one is able to stand, that is not permissible because of the general meaning of the verse in which Allaah says (interpretation of the meaning):
“And stand before Allaah with obedience”
and because of the hadeeth of ‘Imraan ibn Husayn, according to which the Prophet (peace and blessings of Allaah be upon him) said to him: “Pray standing; if you cannot, then sitting; and if you cannot then lying on your side.” (Narrated by al-Bukhaari, 1117).
And Allaah is the Source of strength.
Fataawa al-Lajnah al-Daa’imah, 8/126.