一个“图像”类型的两个提交按钮

时间:2015-12-21 14:48:29

标签: php html

我在PHP中有一个表单,其中有两个类型为“image”的提交按钮。 我如何知道点击了哪个按钮?

代码:

<?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>&euro; ".$_SESSION['producten'][$i]['prijs']."</td>

    ");

?>

1 个答案:

答案 0 :(得分:2)

试试吧:

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
}