I have a PHP script that calls a PHP function, but I want a confirmation box to appear before the script is carried out. I'm seemingly incapable of meshing javascript and PHP, so is there a way to do it that I'm missing? Any help is appreciated.
Remember that PHP is run on the server, JavaScript on the client. In most situations the PHP will be run, it sends the output (including any JavaScript) to the client, then the client executes the JavaScript. Therefore, your PHP script will be completely ignorant of anything the JavaScript is doing, and vice versa. The one exception would be if you did some sort of AJAX implementation, having JavaScript on the client calling a PHP (or other) script on the server, then altering the page output via the DOM based on the output received from the server. If that interests you, a web search on "AJAX PHP tutorial" should give you a few thousand hits.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Bookmarks