Send value of submit button when form gets posted

In PHP, you can access the value of a submit button when a form is posted in the following way:

<?php

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
  $button_value = $_POST['button_name'];
}

Replace button_name with the actual name of your submit button. This will retrieve the value of the submit button that was clicked to post the form.

Here is an example of a form with a submit button:

<form action="form_handler.php" method="post">
  <input type="text" name="text_field" />
  <input type="submit" name="button_name" value="Submit" />
</form>

When this form is submitted, you can access the value of the submit button (Submit in this case) in the form_handler.php script using the code I provided above.