我想知道我的代碼中是否有一種方法可以讓用戶單擊圖像,但在單擊時獲取圖像的值并通過發布請求發送到 PHP 代碼。例如目前我有這個:<div class="grid-2 dashboardIcons"> <h3 class="fontAmaticH1">Mindfulness</h3> <a class="cursor" onclick="toggleWindow()"><img value="6" src="images/Mindfulness.png"></a></div>我是否必須將其包裝在如下所示的表單標簽中?<form method="post"> <a class="cursor" onclick="toggleWindow()"><img value="6" name="module" src="images/Mindfulness.png"></a></form>然后,我的 PHP 代碼將采用該值并對其進行處理:<?php // I need to get the value from the clicking on an image if(isset($_POST['module'])){ //Do something}?>任何幫助將不勝感激!
- 2 回答
- 0 關注
- 119 瀏覽
添加回答
舉報
0/150
提交
取消