The PHP file must be interpreted by the web server (you can use XAMPP, which is a popular set of servers for Windows, including the Apache HTTP server, the MySQL database server, and the PHP extension for Apache).
The server executes the PHP code and sends the script output / result via the http protocol to the web browser.
Opening this file through the file system is a bad idea because the PHP file will be read as plain text if it is not processed by the web server with PHP.
You don't seem to understand how PHP works. You need to read some books on the basics of websites.
After all, you can visit http://thenewboston.org or http://phpacademy.org - they have very good educational videos.
One more tip:
In my personal opinion, Dreamwaver is a very bad tool for learning PHP. For educational purposes, I recommend using Notepad ++ or another IDE (possibly a version of NetBeans PHP). This will help you understand more.
How to debug php code in Dreamweaver cs5?
source share