title: Ajax button update database value
body: <p>I have developed a booking system , it has a button when i click on that button it will update the state of an appointment from pending to completed . Every time i want to complete an appointment i have to click several times. I think it can be done in ajax by clicking only once.</p>
  
  <p><strong>Here is my code</strong> </p>
  
  <pre><code>if ($_REQUEST['command'] == "send") { // if the command send pressed then 
      mysql_query(" UPDATE bookings SET status='sent' WHERE id=$_REQUEST[id]"); // update bookings and set the Statu of the statuts field to sent
  
  }
  if ($_REQUEST['command'] == "Done") { // if the command Done pressed then 
      mysql_query(" UPDATE bookings SET status='Done' WHERE id=$_REQUEST[id]"); //update bookings and set the Statu of the statuts field to Done
  }
  
  if ($_REQUEST['command'] == "Delete") {
      mysql_query(" DELETE FROM bookings  WHERE id=$_REQUEST[id]");
  }
  </code></pre>
  
  <p>if ($a['status'] == 'new') { // if the status statuses equal to "new" then  >
      echo "Confirm"; // print out Send in the Action coulmn! need to be complete!!
      } else if ($a['status'] == 'sent') {
      echo "Sure? ";
      //echo "Delete";
      } </p>
  
  <p>I appreciate if someone can help me with the ajax class to complete this function , </p>
  
  <p>Many thanks in advance.  </p>