I’ve looked around for a long while now and I can’t find anywhere that answers this seemingly basic question. I don’t care if the page reloads or displays the results immediately; I just want to have a button on my website make a PHP file run. That’s it. And I’ve found that all websites either tell you how to run the PHP code in your HTML directly or tell you to use ajax. I’ll use ajax if it turns out to be necessary, but there was a time before ajax existed that PHP was used, so I think there’s a simpler way. If I can write the code inside HTML just fine, why can’t I just reference the file for it in there or make a simple call for it in Javascript?If it does turn out that ajax is the only way forward, what do I need to know about it to call a PHP file that will create a text file on a button press? I’m making a simple blog site for myself and I’ve got the code for the site and the javascript that can take the post I write in a textarea and display it immediately. I just want to link it to a PHP file that will create the permanent blog post on the server so that when I reload the page, the post is still there.Thanks for taking the time to read and answer.
Source: How to call a PHP file from HTML or Javascript – Stack Overflow