It's probably better not to output html from php scripts but rather just define a bunch of vars and then echo them in an included html template - or use a template engine lik smarty.
That instantly removes the syntax issues in your post, although it's still something you need to learn.
I'd recommend that you always concatenate vars and strings, like this:
$string = 'some text' . $var . 'more text';
.. rather than simply chucking the vars into a double quoted string. It's easier to read and less error-prone.