簡體   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