+ 11

I want use PHP inside HTML. How do i do that?

13th Dec 2016, 4:50 PM
Aydin
5 odpowiedzi
+ 3
Of course you can use PHP inside in HTML. But - no HTML, no browser does not know the PHP comands. It is only deal of web server with PHP module. So or you upload your HTML files with PHP in such web server . Or install such web server in your computer for test/developer purposes. Like XAMPP for example
13th Dec 2016, 5:22 PM
Petr Hatina
Petr Hatina - avatar
+ 3
<!DOCTYPE HTML> <HTML Lang="pt-br"> <Head> <title>php inside HTML</title> <meta charset="utf-8"/></Head> <Body> <h1> php <\h1> <?php txt for exemplo /* php inside HTML*/ ?> </body> </HTML>
13th Dec 2016, 5:03 PM
Otávio Guilherme Ferreira dos Santos
Otávio Guilherme Ferreira dos Santos - avatar
+ 2
You'll have to save the file as .php and not .html, else the web server might not parse the php code
13th Dec 2016, 5:16 PM
Rishi Anand
Rishi Anand - avatar
+ 1
He wants to insert php into the HTML file, not create a file in php, if it was to create a file in php he had asked how to create a file in php. Not how to include php inside your HTML
13th Dec 2016, 6:47 PM
Otávio Guilherme Ferreira dos Santos
Otávio Guilherme Ferreira dos Santos - avatar
0
1. create a file with .php extension 2. write your HTML 3. to use PHP with HTML place your PHP code wherever you want like this <?php // your PHP code echo "Good Luck"; ?>
21st Mar 2017, 12:14 PM
Hasan Al-Yazidi
Hasan Al-Yazidi - avatar