PHP within HTML

html
php

#1

Hi all,

I am trying to run PHP within my HTML but it does not output.
So far, it only works when I put the PHP within an iframe, but I would like to put the PHP directly within the HTML file and have it process and output information. How can I get the server to parse the PHP and output it?


#2

Make sure the file is named with a .php extension. You’re technically putting HTML within PHP :slight_smile: From there, make sure you run it with Apache or the PHP server and that should do the trick!


#3

Awesome, thank you! I had it engraved in my head that this was a feasible option; I would have been scratching my head for days. It’s my first time using PHP and I have to migrate a lot of code from JS to PHP and I’m having a pretty tough go at it.

Thanks for the help.