Tefillin contain the following four Parashioth (sections from the Torah):
1. Qaddesh Li
2. Wehaya Ki Yebiakha
3. Shema' Yisrael
4. Wehaya Im Shamowa'
These sections must be written in the above-mentioned order. If they were written out of order they become Pasul (unfit for ritual use).
In addition, the Parashioth for the Tefillin Shel Yad (Tefillin worn on the arm) should be written before the sections for theTefillin Shel Rosh (the ones worn on the head.) However, if they were not written in that order, after the fact (Bedi'abad) they may still be used.
(See Sh. 'A. 32:1 and Rama ibid)