How must elemental symbols be ordered in the formula for a compound?
Yes there is.  The most general rule is that elements are listed in increasing order of electronegativity, and in your case the Pauling ENs are 2.19 (P), 3.04 (N) and 3.16 (Cl), so that's why the application wanted it that way.

Most of the time we approximate that rule by saying elements are listed in increasing order of column of the Periodic Table, so e.g. OF2, CO2, and BF3, and when elements appear in the same column, in decreasing order of period, so e.g. SiC, BrCl and SO3.  The column rule takes precedence over the row rule, because EN varies more strongly left-to-right than up-and-down, generally.

The place where this approximation fails most obviously is with hydrides, since H has an EN close to C but appears at the far left of the Table.  Normally we skip the approximation and mostly use the underlying rule for hydrides, so e.g. BeH2 and GeH4 even though H is above and to the left of Be and Ge  (Pauling EN is 1.57 for Be, 2.01 for Ge, 2.2 for H), but H2O and HF. However CH4 (Pauling En 2.55 for C) doesn't quite follow that rule and NH3 (Pauling EN 3.04 for N) is wildly contradictory.  These may just be historical accidents.