I have a HTML / Twig / Bootstrap file with two buttons:
<form method="post" action="procuser.php">
<div class="form-group">
<label for="Details">Details:</label>
<textarea class="form-control" rows="5" id="details" name="details">{{ details }}</textarea>
</div>
<button type="submit" name="button" value="submit" class="btn btn-default">Submit</button>
<button type="submit" name="button" value="cancel" class="btn btn-default">Cancel</button
<br><span class="err">{{ err }}</span>
</form>
Then in PHP, I check whether the form was submitted / cancelled using the checks:
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
if (isset($_GET["button"]) && $_GET["button"] == "submit")
{
if (postData(input("details"))) // <- never reaches here?
header("success.php");
}
else
header("menu.php");
}
But the submit button does not work and I always get redirected to the menu.