简体   繁体   中英

Post a selected value from a list via on click - PHP/HTML

I have the code:

<table>
<?php foreach (ListFiles('clients/'.$entry) as $key=>$file){?>
<tr>
<td><?php echo $file;?></td>
<td><img src="pdf.png" height="40" width="40" alt="strategic report"></img></td>
</tr>
</table>

.. that generates a list of items within a table. I have added an button to right hand side in a different part of the table.

The question is: when a user clicks on the image, ie onclick, how would I get the value from the corresponding value/item selected?

I'm using PHP.

Cheers

您应该为每个项目提供唯一的ID,然后在单击按钮时将该ID传递给服务器。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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