On and Off Button

On and Off Button

I am using an Action button which is to show if the information from my database is successfully posted to my page, from echoed "Not Posted" --> to "Posted" when the action button is clicked.

  1. <?php echo '<a href="#po'.$rs['id'].'" data-toggle="modal" class="btn btn-success" id="post">Action</a>'; ?>
here is the code for echoing the "Posted" when the action button was clicked;
  1. <php 
  2.       $status=$rs['post'];
  3.             if ($status<2){
  4.                        echo "<td>Not Posted</td>";
  5.             }else{
  6.                        echo "<td> Posted</td>;
  7.             }
  8. ?>
QUESTION: what way should I do if i like the Action Button is continues clickable like On and Off button?
ie: from Not Posted --> Posted  /  Posted --> Not Posted.