if you are using a local server (XAMPP, for example), and you access your webpage by double clicking on the html file, then the address in the browser will be
file:///C:/xampp/htdocs/(filename).html
which will NOT run PHP for some reason. The correct address to use to access your html file with PHP code in it is
http://localhost/(filename).html
which accesses the html file in a way that the PHP works, and needs to be entered directly into the browser, then bookmark your local host directory so you can easily access your files through the browser instead of clicking on the icons in explorer or through the terminal
fyi the address prefix is persistent, so it will carry through to linked pages, which means if PHP doesn't work on the first page then it won't work on any of the other pages on your website, conversely, if the first page works, then the rest will too