Any way to invoke a php script besides user clicking a button on a form?
The only way I know to run a php script is to put the name of the script in a <form action=""> tag. Are there any other options?
I have a situation where I would like to start a php script without relying on the user to press a button. I tried putting php code in a .html file, but when I load the file from the server it doesn’t execute any php.
Thanks,
Houyhnhnm
if you want the PHP code to execute as soon as the page is loaded, just rename the extension to .PHP and hyperlink the file as normal. It will execute when the page is rendered by the server and sent back to your browser.
In order to run embedded php (or any other language) in a .html file the server has to be enabled to handle it and understand that the .html file contains code.
Usually "html" files that contain code have some sort of special extension like .php, .aspx, .cgi, etc…