ItDoesntWorkIsUseless. In the future, please tell us what you expected to happen and what actually happened.
You're trying to compose a string and assign it to a variable. You can't use
echo for this, because
echo is for printing strings to the output, not for composing them.
Using braces to expand your variable won't work, because you've used single quotes around your string. Variable expansion only works in double quoted strings and when using Heredoc syntax.
Heredoc might actually be useful in this case, because you won't have to escape all the double quotes that you use inside your string. It would look something like this:
A much much much better solution however is to not build up your HTML page in such a piecemeal fashion, but instead create a template for the entire page in a language like Blade or Twig, and then pass the values you want to inject into the template from your PHP controller.