Q:

Submitting one value of the Hidden input in the current row clicked

How to pass one value of the current row of multiple hidden input in PHP. I have the following code:
foreach($portfolio as $portfolio){
echo  "<tr class ='table-comments'>";
echo  "<td>".$portfolio['portfolio_title']."</td>";
echo  "<td class = 'comment-content'>".$portfolio['portfolio_client']."</td>";
echo  "<td><a target = '_blank' href = ".$portfolio['portfolio_link'].">".$portfolio['portfolio_link']."</a></td>";
echo  "<td>";
echo  "<input type='hidden' name='portfolio_id' value='" . $portfolio['portfolio_id'] . "' />";
echo "<input type = 'submit'  value = 'Edit'>";
echo "<input type = 'submit' value = 'Move to Trash' class = 'action-button'>";
echo  "</td>";
echo  "</tr>";
}

I also have submit button each row that triggers the form. When I click the submit button, it submits all the value of the row of the hidden input. I only want the clicked button row value.
URL is like this:
/portfolio?portfolio_id=1&portfolio_id=2&portfolio_id=3&portfolio_id=4 and so on
I only want
/portfolio?portfolio_id=3

A:

Have a new form for each row...
<form method="get">

</form>

Like this:
foreach($portfolio as $portfolio){

    echo  "<tr class ='table-comments'>";
    echo  "<td>".$portfolio['portfolio_title']."</td>";
    echo  "<td class = 'comment-content'>".$portfolio['portfolio_client']."</td>";
    echo  "<td><a target = '_blank' href = ".$portfolio['portfolio_link'].">".$portfolio['portfolio_link']."</a></td>";
    echo  "<td>";
    echo '<form method="get">';
    echo  "<input type='hidden' name='portfolio_id' value='" . $portfolio['portfolio_id'] . "' />";
    echo "<input type = 'submit'  value = 'Edit'>";
    echo "<input type = 'submit' value = 'Move to Trash' class = 'action-button'>";
    echo "</form>";
    echo  "</td>";
    echo  "</tr>";

}

