title: How to check duplicate but without refresh page? PHP
body: <p>this is my coding. I want to check the duplicate data. If duplicate data exists, the alert will pop-out, but once I click on OK, it will go to a blank page and cannot return to the form. How to make it pop-out an alert but without refresh the page?</p>
  <pre><code>&lt;?php
  
  include &quot;db_con.php&quot;;
  if (isset($_POST['edit_appt'])) {
      $appointment_id = $_POST['appointment_id'];
      $job_number = $_POST['job_number'];
      $technician_id = $_POST['technician_id'];
      $appointment_date = $_POST['appointment_date'];
      $appointment_time = $_POST['appointment_time'];
  
      $query = &quot;SELECT * FROM appointment WHERE technician_id='$technician_id' &amp;&amp; appointment_date='$appointment_date' &amp;&amp; appointment_time='$appointment_time';&quot;;
      $result = mysqli_query($con, $query);
      if (mysqli_num_rows($result) == 1) {
          echo &quot;&lt;script&gt;alert('Technician is unavailable! Please select another technician!!')&lt;/script&gt;&quot;;
      } else {
          $query2 = &quot;UPDATE appointment SET technician_id='$technician_id' WHERE appointment_id='$appointment_id'&quot;;
          $result2 = mysqli_query($con, $query2);
          if ($result2) {
              $query1 = &quot;UPDATE reparation SET technician_id='$technician_id',notification_status='unread' WHERE job_number='$job_number'&quot;;
              $result1 = mysqli_query($con, $query1);
              if ($result1) {
                  echo &quot;&lt;script&gt;alert('Updated!')&lt;/script&gt;&quot;;
                  echo &quot;&lt;script&gt;window.open('admin_appt.php','_self')&lt;/script&gt;&quot;;
              }
          }
      }
  }
  </code></pre>