+ 2

How can you activate php to work for my html website?

I have been writing lots of html, js and css code recently but now i need data storing using php however I haven't gotten the php code to work for my html website as it doensn't seem to be processed. any suggestions of how to make it work?

4th Oct 2019, 4:53 PM
Matthew Molski
Matthew Molski - avatar
4 odpowiedzi
+ 3
I used XAMPP to initialise a local server so I can test my php code, did you check your web host if their service supports php? 🔻How to use XAMPP in a nutshell🔻 To use XAMPP make sure you dont use index.html but index.php once local server running type in your browser localhost/ 《name of file in XAMPP's htdocs file directory》 hopefully this helps and your <php? tags will hopefully process
5th Oct 2019, 5:00 AM
SpaceJam♨
SpaceJam♨ - avatar
+ 2
Can you be more precise in what do you want obtain?
4th Oct 2019, 6:06 PM
KrOW
KrOW - avatar
+ 1
Ok I will try to explain: My php file doesn't seem to interact with my index file. I've made many websites before however I've never made them with php so my big question I was trying to ask is how do I link php to HTML so I can use php code?
4th Oct 2019, 6:31 PM
Matthew Molski
Matthew Molski - avatar
+ 1
You can use include or require. Include example: <?php include 'footer.php';?> <-- will try to load your PHP script in HTML. If it fails loading your PHP file, it will just continue loading your HTML file. Require example: <?php require 'footer.php';?> <-- Requires your PHP script to load alongside your HTML file else both will fail to load resulting in an error. Make sure you also specify the directory of your .php file else it won't work. SOURCE: https://www.php.net/manual/en/function.include.php Is this what you meant? -If so, hope it works for you.
13th Oct 2019, 8:14 PM
oushima
oushima - avatar