How To Submit Same Form For Different Purpose Using Two

[Solved] How To Submit Same Form For Different Purpose Using Two | Php - Code Explorer | yomemimo.com
Question : how to submit same form for different purpose using two submit button in php

Answered by : ankur-prajapati

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 }
?>

Source : https://stackoverflow.com/questions/11929471/how-do-i-use-two-submit-buttons-and-differentiate-between-which-one-was-used-to | Last Update : Mon, 25 Oct 21

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

Code Explorer Popular Question For Php