Reputation: 376
I have a form in PHP with two submit buttons of type 'image'. How do I know which button is clicked?
Code:
<?php
echo ("
<form action='WijzigSession.php' method='POST'>
<td><input class= 'nummers' type='number' name='aantal' value=".$_SESSION['producten'][$i]['aantal']." min='1' max='20'>
<input name='refresh' class='buttons' type='image' src='img/refresh.png'</a>
<input name='delete' class='buttons' type='image' src='img/delete.png'</a>
<input type='hidden' name='id' value='$i'>
</form></td>
<td>€ ".$_SESSION['producten'][$i]['prijs']."</td>
");
?>
Upvotes: 0
Views: 70
Reputation: 6081
Just try:
if(isset($_POST['refresh_x'])) { //you can potentially even check for '$_POST['refresh_y']'
// refresh is clicked
}
if(isset($_POST['delete_x'])) {
// delete is clicked
}
Upvotes: 1