Hi mjcloward. Welcome to the forums.
For one thing, your pages need a doctype. Even this will do:
Always include a doctype at the top of your HTML.
I'm not sure if there's anything wrong with your PHP—but that's not an issue for this forum. I would suggest that you put a space between the closing ?> and what comes before it, but I don't know if that's an error or not.