you can call a php function from html have include? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

you can call a php function from html have include?

10th Oct 2016, 1:23 AM
Monica Andrea Corrales Palma
3 Answers
+ 1
No this is not possible, since you must be in an .PHP file to use PHP
12th Nov 2016, 9:55 AM
Thomas Mout
Thomas Mout - avatar
0
A little late, but try this. This defintely works for me: <?php yourFunction() { $var = "whatever you want to do in this funct"; } ?> <!DOCTYPE html> <html> <body> <h1>Welcome to my home page!</h1> <p>Some text.</p> <p>Some more text.<?php yourFunction(); ?></p> </body> </html> BTW....you have to save your file as .php. You can't run it as a .html file and expect the php engine to parse it. It's a PHP server.
6th Dec 2017, 5:39 AM
Ray
Ray - avatar
- 1
<html> <body> <h1>Welcome to my home page!</h1> <p>Some text.</p> <p>Some more text.</p> <?php include 'footer.php';?> </body> </html>
10th Oct 2016, 3:15 AM
Ray
Ray - avatar