A couple of possibilites.
A)Put the second button in a separate form.
If that's not feasible there's plan B
😎 multiple submit buttons with same name, different values
<form action="apage.php" method="POST">
<input type="submit" name="action" value="Button A">
<input type="submit" name="action" value="Button B">
</form>
In apage.php, check the value in $_POST["action"]
if it is "Button B", redirect to your other page with a location header.
HTH