php - unsetting array by key within WP Loop -
i trying unset array has same [key] post id within wordpress loop, using following...
<form action="" method="post"> <button class="btn btn-danger btn-l pull-right" type="submit" name="exercisedelete" value="exercisedelete">yes</button> </form> <?php $exid = the_id() ?> if (!empty($_post['exercisedelete'])) { echo ' <script type="text/javascript"> location.reload(); </script>'; unset($_session['collection'][$exid]); } ?> i have performed echo on exid @ stages on , picking correct title. if hard code $exid in unset works fine also.
the problem having when $_post sent unsets final key in $session[collection] rather 1 correct key.
i have had working before think possibly not best method. there better way of running functions on buttons rather using $_post??
many in advance.
Comments
Post a Comment