When I tried running your code as-is I also “got an error.” That type of super-error means the PHP is badly formatted, so badly that PHP couldn’t even tell you where to look to fix the problem.

Here’s how I rewrote the code so that it would run: