Thanks guys. Allen's structure is working great. I can work off that well enough to rewrite for my school (I am a teacher here!)

Now this is not an argument, just a dummy question or two:

1) Why is my old script broken? It was working fine with that structure for years until I probably stuffed up the syntax somewhere. What happens if you don't put endifs after each if statement. The structure has been the same for years.

2) Does it matter if I put line breaks anywhere in the new script? I am sure this sounds too obvious and stupid but would love it if someone had the time to answer:)

Cheers all:)