This is such a convoluted way of doing this. You should separate the delete_user_meta
call from the foreach
entirely and put type="hidden"
inputs in the form with the rest of the data you need.
if(isset($_POST["Remove"])){
delete_user_meta(get_current_user_id(), 'pluginlink', $_POST["value"]);
}//end if
Form
<form method="post" enctype="multipart/form-data" >
<button type="submit" name="Remove" value="<?php echo $k1mlsid; ?>" style="background-color: #fff; padding-left:3px;"><i class="fa fa-heart" aria-hidden="true" ><?php echo $loginouttext; ?></i></button>
<input type="hidden" name="value" value="<?php echo $value; ?>">
</form>
Another way of tackling this would be to not use forms at all. Instead you use a link, like <a class="deletebutton" href="/?user-updates=remove&value=data">
. Then you create a script to handle these queries.
if (isset($_GET['user-updates']) && $_GET['user-updates'] == 'remove') {
delete_user_meta(get_current_user_id(), 'pluginlink', $_GET["remove"]);
}
It does the same thing with way less code, easier CSS, and easier AJAX in the future if you decide to add QOL improvements.