I thought for a while you’d nailed the problem, but I had to go researching where to put the braces with respect to the alternating php and html. Not altogether, but eventually arrived at this page in the official php manual --I actually only found this because I was having trouble finding any reference to the endif statement.
The reason, I now think I see, that the endif statement is uncommon is precisely that it is superflous with the common brace usage. However, it seems that using colons for the condition statements along with a control structure end statement is a correct alternative to braces, and it gets special mention with regard to clarifying mixed php and html.
I can’t see anything materially different in my script’s control structure, colons and endif included, from the examples on the manual page.
So I’m back to square one.
The only other clue I found in my searching was a lot of references to php changes involving register_globals and Superglobals–all way over my head.
Maybe I would do better to find another ready-made script that works. I’ve looked at a few but they seemed way too fancy when all I want to do is let site visitors email me without giving my address to spammers.