add another solution based on @ karim79, as it is marked with PHP:
<form id="theForm" action="foo.php">
...
<input id="first" name="button" value="first" type="submit"/>
<input id="second" name="button" value="second" type="submit"/>
</form>โ
in your foo.php, do something like this:
<?php
$submit = isset($_GET['button']) ? trim($_GET['button']) : '';
if($submit == 'first')
{
header('Location: somePage.php');
}
else if($submit == 'second')
{
header('Location: anotherPage.php');
}
?>
Summary: in order to read on your button (2 submit buttons), you need to add namefor each of them. To make it simple, just use the same name for both. Then add different ones value. Then you need to find out which button is pressed, checking what value is sent on that particular button .
source
share