Currently, I’m developing an application using standard PHP. As such, there are assorted functions that are called from forms. Some examples include registration, login, logout, and others.
Rather than creating a separate file for each function, I’m using a phpscripts.php file in the includes folder. To execute a function from html input, I pad the URL with ?action=functionName. Inside the script file, I use a switch/case tree to execute the proper function based on the S_GET['action'] variable.
Is there a better way to implement HTML calls to PHP functions?
No, that is the correct way to interface a HTML form with a PHP script. Other alternatives would include employing URL rewriting (to convert something like
/actions/functionname/paramto?action=functionname¶m=x), but the basic principle remains the same.