Friday, 25 October 2013

Multiple submit button in a single form in PHP

<form method="post">
<input type="submit" name="save" value="Submit 1">
<input type="submit" name="cancel" value="Submit 2">
</form>


<?php
if (isset($_POST['save'])) {
  // code
}
else if (isset($_POST['cancel'])) {
  // code
}
?>