How can a PHP function be triggered with a parameter by an input button?

To trigger a PHP function with a parameter by an input button, you can use a form with a hidden input field to pass the parameter value to the PHP script when the button is clicked. In the PHP script, you can retrieve the parameter value using the $_POST superglobal array and then call the function with the parameter.

<?php
// Check if the form is submitted
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    // Retrieve the parameter value from the hidden input field
    $param = $_POST['param'];

    // Call the function with the parameter
    yourFunction($param);
}

// Define the function
function yourFunction($param) {
    // Your function code here
}

?>

<form method="post">
    <input type="hidden" name="param" value="parameter_value">
    <input type="submit" value="Trigger Function">
</form>