title: How to reload page on submitting a button in the modal
body: <p>I am a beginner I am using php and javascript. I want to refresh the page view_create_journals.php when I click on the change button in the modal. I add a function to the change button but it's not working. I badly stuck here. Please give me some advice how to solve this problem. Thanks in advance guys. Codes are given below : </p>
  
  <p>view_created_journals.php</p>
  
  <pre><code>        &lt;section&gt;
          &lt;div class="container"&gt;
              &lt;div class="panel-group"&gt;
                  &lt;div class="panel panel-info" style="padding: 10px 10px 10px 10px;"&gt;
                      &lt;div class="panel-heading" style="color:black;font-size: 16px;"&gt;Plantation Journal Entry Basic Details&lt;/div&gt;
                      &lt;div class="panel-body"&gt;
                          &lt;form method="post"&gt;
                          &lt;div class="table-repsonsive"&gt;
                              &lt;table class="table table-bordered" id="item_table1"&gt;
                                  &lt;thead&gt;
                                      &lt;tr&gt;
                                          &lt;th&gt;Journal No.&lt;/th&gt;
                                          &lt;th&gt;Range&lt;/th&gt;
                                          &lt;th&gt;Beat&lt;/th&gt;
                                          &lt;th&gt;Scheme&lt;/th&gt;
                                          &lt;th&gt;Year&lt;/th&gt;
                                          &lt;th&gt;Status&lt;/th&gt;
                                          &lt;th&gt;Change Status&lt;/th&gt;
                                          &lt;th&gt;View&lt;/th&gt;
                                      &lt;/tr&gt;
                                  &lt;/thead&gt;
                                  &lt;tbody&gt;
                                      &lt;?php 
                                      $query="select * from plantation_journal_basic_details";
                                      $result=mysqli_query($con,$query);
                                      while ($row=mysqli_fetch_assoc($result)) {
                                          $plantation_journal_no=$row['plantation_journal_no'];
                                          $ranges=$row['ranges'];
                                          $beat=$row['beat'];
                                          $scheme=$row['scheme'];
                                          $year=$row['year'];
                                          $status=$row['status'];
                                          echo "&lt;tr&gt;
                                                      &lt;th style='font-weight:300'&gt;$plantation_journal_no&lt;/th&gt;
                                                      &lt;th style='font-weight:300'&gt;$ranges&lt;/th&gt;
                                                      &lt;th style='font-weight:300'&gt;$beat&lt;/th&gt;
                                                      &lt;th style='font-weight:300'&gt;$scheme&lt;/th&gt;
                                                      &lt;th style='font-weight:300'&gt;$year&lt;/th&gt;
                                                      &lt;th style='font-weight:300'&gt;$status&lt;/th&gt;
                                                      &lt;th&gt;&lt;a  name='view' id='view' class='btn btn-danger btn-sm'  data-toggle='modal' data-target='#change'&gt;Change Status&lt;/a&gt;&lt;/th&gt;
                                                      &lt;th&gt;&lt;a  href='all_details.php?id=".$row['plantation_journal_no']."' name='view' id='view' class='btn btn-info btn-sm'&gt;View&lt;/a&gt;&lt;/th&gt;
                                                  &lt;/tr&gt;";
                                                  if(isset($_POST['status'])){
                                                      $status=$_POST['status'];
                                                      $sql1="UPDATE plantation_journal_basic_details SET status='$status' where plantation_journal_no='$plantation_journal_no';";
                                                      $res=mysqli_query($con,$sql1);
                                                  }
                                      }?&gt;
                                  &lt;/tbody&gt;
                              &lt;/table&gt;
                          &lt;/div&gt;
                          &lt;/form&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/section&gt;
      &lt;div class="modal fade" id="change" role="dialog"&gt;
      &lt;div class="modal-dialog"&gt;
  
        &lt;!-- Modal content--&gt;
        &lt;div class="modal-content"&gt;
          &lt;div class="modal-header"&gt;
            &lt;button type="button" class="close" data-dismiss="modal"&gt;&amp;times;&lt;/button&gt;
            &lt;h4 class="modal-title"&gt;Change Status&lt;/h4&gt;
          &lt;/div&gt;
          &lt;div class="modal-body"&gt;
              &lt;form action="view_created_journals.php" method="post"&gt;
                  &lt;label&gt;Status : &lt;/label&gt;
                  &lt;select name="status" id="status"&gt;
                      &lt;option value="Committed"&gt;Committed&lt;/option&gt;
                      &lt;option value="Edit and Submit"&gt;Edit and Submit&lt;/option&gt;
                      &lt;option value="Edited and Submitted"&gt;Edited and Submitted&lt;/option&gt;
                      &lt;option value="Approved"&gt;Approved&lt;/option&gt;
                  &lt;/select&gt;&lt;br&gt;&lt;br&gt;
                  &lt;button type="submit" class="btn btn-info" onclick="myFunction()" name="submit_change"&gt;Change&lt;/button&gt;
          &lt;/form&gt;
          &lt;script&gt;
          function myFunction() {
              location.reload();
          }
          &lt;/script&gt;
          &lt;/form&gt;
          &lt;/div&gt;
          &lt;div class="modal-footer"&gt;
            &lt;button type="button" class="btn btn-default" data-dismiss="modal"&gt;Close&lt;/button&gt;
          &lt;/div&gt;
        &lt;/div&gt;
  
      &lt;/div&gt;
    &lt;/div&gt;
  </code></pre>