call funcution when clicking submit

    <?php
        if(array_key_exists("button1', $_POST)) { 
            button1(); 
        } 
        function button1() { 
            echo "This is Button1 that is selected"; 
        } 
    ?> 

    <form method="post"> 
        <input type="submit" name="button1"
                class="button" value="Button1" /> 
        
    </form> 
</head> 

</html> 

you call button click function this type you need more refrance follow this link