$data = $_POST;
if (isset($data['delete-post'])) {
$id = $_GET['id'];
$delete_post = R::findOne('posts', $id);
R::trash( $delete_post );
}
foreach ($posts as $post) {
echo '
<form action="'.$_SERVER['REQUEST_URI'].'" method="POST">
<button type="submit" name="delete-post">Trash</button>
</form>
';
}