Separated PHP source file | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Separated PHP source file

Hello. I am interested in php, because I need it to work with sql database on my page and I want to ask, is it possible to write my code into a separated file with .php extension? Currently I have .html , .css and .js files and I have all of them connected in <head> section via <script src=JS.js> and <link> tags. But I couldn't find any help in lessions comments. Is it possible or do I have to write all the php code into my html file and save it with .php exception?

23rd Jun 2018, 10:18 AM
Jan Štěch
Jan Štěch - avatar
1 Answer
+ 1
Hello there, You have to save file in php to work it like a html if not then make seperate file and use it as an api hit by ajax in this json response is there.In this you have to make a index.html and api.php. Best of luck
23rd Jun 2018, 10:26 AM
ᴋᵘⁿᵃˡ
ᴋᵘⁿᵃˡ - avatar