PHP GET ID和从模态中选择的复选框,以插入/更新到数据库中

I am populating dates using ajax ( as seen in image 1). You click on “select” for the date you want and a modal pops-up that offer time slots (via checkboxes, as seen in image_2). Once checkboxes are checked for the time slots needed, the modal is closed, and the rest of the form is filled out and submitted. I am having a bit of difficulty capturing the id and selected checkboxes from the modal because when I send it to the database, nothing happens. The rest of the form info submits to its allocated areas in the DB except the date and time slots. So I apparently am missing something on capturing the id and checkbox info from the modal as to where to make the update.

Image 1

image one

Image 2

image two

I have tried capturing the id and info a few ways including putting the id in the select button and capture it that way as well as with a “GET” request, with no luck.

I would appreciate some insight and appreciate your input.

Here is the code for the modal so you can see the ID and info that is populated. ( please note this is the top and bottom half of the modalcode as it is quite a bit of code and wont all fit here).

     <!--  SCHEDULE TIMESLOT MODAL -->
<div class="modal fade" id="selectDate<?php echo $idDate;?>" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel"><i class="fa fa-calendar"></i> <?php echo $day_of_week ." ". $full_date;?></h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
      <div class="alert alert-danger" role="alert">
  <h4 style="font-size:20px !important;" class="alert-heading"><i class="fa fa-exclamation-triangle"></i> Notice</h4>
  <p>Select your appointment time from the green check boxes. If your appointment goes over the three hour time window please use the block function for the additional times that are needed.</p>

</div>
    <div class="row">

            <?php

            $query = "SELECT * FROM jobschedule_101 WHERE iddate = '$idDate'";
            $select_date = mysqli_query($connection, $query);
            confirm($select_date);

            while($row = mysqli_fetch_array($select_date)){

                 // JOB ONE ////////////////////

              $timeSlotOneJobOneChk = "
              <div class='form-check form-check-inline'>
              <input class='form-check-input' type='checkbox' value='1' name='slotOneJobOne' id='slotOneJobOne'>
              <label class='form-check-label text-success' for='defaultCheck1'>
              6AM-8AM (1)
              </label>
              </div>
              <div class='form-check form-check-inline ml-3'>
              <input class='form-check-input' type='checkbox' value='2' name='slotOneJobOne' id='slotOneJobOne'>
              <label class='form-check-label' for='inlineCheckbox2'>Block</label>
              </div>
              ";



                  // TIME SLOT ONE      

                   if($timeSlotOneAvailability == 1){

                       $timeSlotOneJobTwoChk = "";
                       $timeSlotOneJobThreeChk = "";
                       $timeSlotOneJobFourChk = "";
                       }

                    if($timeSlotOneAvailability == 2){

                       $timeSlotOneJobThreeChk = "";
                       $timeSlotOneJobFourChk = "";
                       }

                    if($timeSlotOneAvailability == 3){

                       $timeSlotOneJobFourChk = "";
                       } 

                       // TIME SLOT TWO 

                    if($timeSlotTwoAvailability == 1){
                        $timeSlotTwoJobTwoChk = "";
                        $timeSlotTwoJobThreeChk = "";
                        $timeSlotTwoJobFourChk = "";
                        } 

                    if($timeSlotTwoAvailability == 2){

                        $timeSlotTwoJobThreeChk = "";
                        $timeSlotTwoJobFourChk = "";
                        }
                    if($timeSlotTwoAvailability == 3){


                        $timeSlotTwoJobFourChk = "";
                        }              

                     // TIME SLOT THREE 

                     if($timeSlotThreeAvailability == 1){
                         $timeSlotThreeJobTwoChk = "";
                        $timeSlotThreeJobThreeChk = "";
                        $timeSlotThreeJobFourChk = "";

                         }

                     if($timeSlotThreeAvailability == 2){

                        $timeSlotThreeJobThreeChk = "";
                        $timeSlotThreeJobFourChk = "";

                         }   

                    if($timeSlotThreeAvailability == 3){
                        $timeSlotThreeJobFourChk = "";
                         }

                    // TIME SLOT FOUR 

                        if($timeSlotFourAvailability == 1){
                         $timeSlotFourJobTwoChk = "";
                        $timeSlotFourJobThreeChk = "";
                        $timeSlotFourJobFourChk = "";

                         } 

                        if($timeSlotFourAvailability == 2){

                        $timeSlotFourJobThreeChk = "";
                        $timeSlotFourJobFourChk = "";

                         } 

                        if($timeSlotFourAvailability == 3){

                        $timeSlotFourJobFourChk = "";

                         } 


                        // TIME SLOT FIVE  

                        if($timeSlotFiveAvailability == 1){
                         $timeSlotFiveJobTwoChk = "";
                        $timeSlotFiveJobThreeChk = "";
                        $timeSlotFiveJobFourChk = "";

                         }

                        if($timeSlotFiveAvailability == 2){
                        $timeSlotFiveJobThreeChk = "";
                        $timeSlotFiveJobFourChk = "";

                         }


                        if($timeSlotFiveAvailability == 3){

                        $timeSlotFiveJobFourChk = "";

                         }      

             /// END JOB AVAILABILITY VALIDAITON /////


              $schedule_block_job_one = "
              <div class='col-5 p-2 pb-4 m-1 bg-light shadow-sm'>

              <div class='form-check pl-5 pt-2 mb-0 time-slot'>
              $timeSlotOneJobOneChk
              </div>

              <div class='form-check pl-5 pt-0 mb-0 time-slot'>
              $timeSlotOneJobTwoChk
              </div>

              <div class='form-check pl-5 pt-0 mb-0 time-slot'>
              $timeSlotOneJobThreeChk
              </div>

              <div class='form-check pl-5 pb-2 mb-2 time-slot'>
              $timeSlotOneJobFourChk
              </div>

              <div class='form-check pl-5 pt-2 mb-0 time-slot'>
              $timeSlotTwoJobOneChk
              </div>

              <div class='form-check pl-5 pt-0 mb-0 time-slot'>
              $timeSlotTwoJobTwoChk
              </div>

              <div class='form-check pl-5 pt-0 mb-0 time-slot'>
              $timeSlotTwoJobThreeChk
              </div>

              <div class='form-check pl-5 pb-2 mb-2 time-slot'>
              $timeSlotTwoJobFourChk
              </div>

              <div class='form-check pl-5 pt-2 mb-0 time-slot'>
              $timeSlotThreeJobOneChk
              </div>

              <div class='form-check pl-5 pt-0 mb-0 time-slot'>
              $timeSlotThreeJobTwoChk
              </div>

              <div class='form-check pl-5 pt-0 mb-0 time-slot'>
              $timeSlotThreeJobThreeChk
              </div>

              <div class='form-check pl-5 pb-2 mb-2 time-slot'>
              $timeSlotThreeJobFourChk
              </div>

              </div> 
              <div class='col-5 p-2 pb-4 m-1 bg-light shadow-sm'>

              <div class='form-check pl-5 pt-2 mb-0 time-slot'>
              $timeSlotFourJobOneChk
              </div>

              <div class='form-check pl-5 pt-0 mb-0 time-slot'>
              $timeSlotFourJobTwoChk
              </div>

              <div class='form-check pl-5 pt-0 mb-0 time-slot'>
              $timeSlotFourJobThreeChk
              </div>

              <div class='form-check pl-5 pb-2 mb-2 time-slot'>
              $timeSlotFourJobFourChk
              </div>

              <div class='form-check pl-5 pt-2 mb-0 time-slot'>
              $timeSlotFiveJobOneChk
              </div>

              <div class='form-check pl-5 pt-0 mb-0 time-slot'>
              $timeSlotFiveJobTwoChk
              </div>

              <div class='form-check pl-5 pt-0 mb-0 time-slot'>
              $timeSlotFiveJobThreeChk
              </div>

              <div class='form-check pl-5 pb-2 mb-2 time-slot'>
              $timeSlotFiveJobFourChk
              </div>

              <div class='form-check pl-5 py-2 mb-2 time-slot'>

              </div>

              </div>";

                echo $schedule_block_job_one;

            }//END WHILE



            ?>




        </div> <!-- ./row -->
      </div> <!-- ./modal body -->
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>

      </div>
    </div>
  </div>
</div>

<!--  END SCHEDULE TIMESLOT MODAL -->



                <?php                   


            $schedule_block = "
            <div class='col p-2 pb-4 m-1 bg-light shadow-sm'>

            <h6 class='text-center'>{$day_of_week}</h6>
            <h6 class='text-center'>{$full_date}</h6>
            <hr>

            <div class='col-12 text-center'>
            <button type='button' data-id='$idDate'  data-toggle='modal' data-target='#selectDate$idDate ' class='btn btn-sm btn-primary'>Select</button>


        </div>


        </div>";


         echo $schedule_block;

         } // end while 

**Here's where i've tried to capture the info from the modal to insert/update into the DB here **

if (isset($_POST['slotOneJobOne'])) {
    $schedule_query = "UPDATE jobschedule_101 SET ";
    $schedule_query .= "slotOneJobOne               = '{$timeSlotOneJobOneChk }'    , ";
    $schedule_query .= "slotOneJobOneCustId         = '{$the_cust_id }'             , ";
    $schedule_query .= "slotOneJobOneStandardJobId  = '{$standard_job_id }'         , ";
    $schedule_query .= "slotOneJobOneAssemblers     = 'none'                          ";
    $schedule_query .= "WHERE idDate ='$idDate' ";  

    $confirm_sechedule_query = mysqli_query($connection, $schedule_query);
    confirm($confirm_sechedule_query);

} // end ifset slotonejobone

As i mentioned this is the only place i am super stuck and anyhelp would be appreciated.. if i need to provide more info or more details please let me know.

Thank you very much :) <3