How do you add an external PHP script to an HTML one¿? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How do you add an external PHP script to an HTML one¿?

Adding an external CSS script to HTML is like : <link rel="stylesheet" src="styles/sometime.css"/> so, how can I add an external php script¿?

4th Apr 2018, 6:57 AM
Laurent M•T K-S
Laurent M•T K-S - avatar
2 Answers
+ 3
It depends. If you want to import a file in PHP which contains functions then you must call it from another .php file. I don't think you can include an .php file in an .html file. From an .php file it is as easy as include or require your file: include 'my_file.php' or require 'my_file.php' If you just want to get data from a PHP file, you can do it like this: https://www.w3schools.com/php/php_ajax_php.asp
4th Apr 2018, 7:08 AM
Mickel
Mickel - avatar
+ 1
https://stackoverflow.com/questions/14079459/include-external-php-files
4th Apr 2018, 7:08 AM
Memphis Reigns
Memphis Reigns - avatar