How to call a php function on click of a hyperlink??

    put a call to the function in a php page on your server and then have the hyperlink point to that page.

      but what if my function and the hyperlink are on the same page?

        <?php
        if($_GET['run'] == 'somefunction')
            somefunction();
        
        echo '<a href="' . $_SERVER['PHP_SELF'] . '?run=somefunction">Click Me</a>';
        
        function somefunction() {
            echo 'You clicked click me. <br />';
        };
        ?>
          Write a Reply...