Answers for "how to submit same form for different purpose using two submit button in php"

PHP
0

how to submit same form for different purpose using two submit button in php

Give each input a name attribute. Only the clicked input's name attribute will be sent to the server.

<input type="submit" name="publish" value="Publish">
<input type="submit" name="save" value="Save">
And then

<?php
    if (isset($_POST['publish'])) {
        # Publish-button was clicked
    }
    elseif (isset($_POST['save'])) {
        # Save-button was clicked
    }
?>
Posted by: Guest on October-18-2021

Code answers related to "how to submit same form for different purpose using two submit button in php"

Browse Popular Code Answers by Language