the Dreamweaver File -> Validate -> Validate Currant Document (W3C) command copies the entire source code of the page and sends it to be validated by the W3C, this includes the raw php code on the page. That will never validate correctly, because php cannot be validated as HTML code.
To be able to validate the page correctly using the dreamweaver command, you need to set a remote server in your site definition, and use the File -> Validate -> Validate Live Document (W3C). This will be basically the same as going to the W3C validation site:
validator.w3.org/
and entering the address for the page on your site to validate.