while the soldiers were advancing they did not realise that the enemy were planning a surprise attack.
while the soldiers advanced they did not realise that the enemy had planned a surprise attack.
while the soldiers advanced they did not realise that the enemy were planning a surprise attack.
Are all of these correct?
No. You have an elementary error in the first word of all 3.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.
Every sentence has to start with a capital letter. Every day I spend time correcting dozens of such errors. I know it seems like a small thing, but it makes your English look surprisingly poor.
I'd consider placing a comma after each 'while' clause. Other than that, your 3 sentences are all correct grammar, but the meanings are not exactly the same. Can you see that?