繁体   English   中英

一种形式为“图像”类型的两个提交按钮

[英]two submit buttons in one form of type 'image'

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

码:

<?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>

    ");

?>

你试一试:

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
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM