0
    <?php
    include("include/connect.php");  ?>        


       <?php
       if(isset($_REQUEST['submitform1']))
       {
      $timepicker1=$_REQUEST['timepicker1'];
      $timepicker2=$_REQUEST['timepicker2'];
       echo $timepicker1;
       echo $timepicker2;
      $timepick1=explode(":",$timepicker1); 
      $timepick2=explode(":",$timepicker2); 
      array_pop($timepick1);
      array_pop($timepick2);

      array_push($timepick1,"00");
      array_push($timepick2,"00");

      $time1=implode(":",$timepick1);
      $time2=implode(":",$timepick2);

      $timeone=preg_replace('/\s+/', '', $time1);
      $timetwo=preg_replace('/\s+/', '', $time2);

     $start_date = new DateTime($timeone);
     $since_start = $start_date->diff(new DateTime($timetwo));
     $diff=$since_start->i;
     echo $diff;

     exit;

       }


        ?>



        <!DOCTYPE html>
        <html>
        <head>
            <meta charset="utf-8">
            <title>Basic Bootstrap Template</title>
            <meta name="viewport" content="width=device-width, initial-scale=1.0">

          <link href="css/bootstrap.css" rel="stylesheet">
           <link href="css/timepicki.css" rel="stylesheet">
            <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
            <link rel="stylesheet" type="text/css" href="css/bootstrap-theme.min.css">
            <link rel="stylesheet" type="text/css" href="css/bootstrap-fileinput.css">
            <link rel="stylesheet" href="css/jquery-ui.css">

            <link rel="stylesheet" type="text/css" href="css/datepicker.css">

        </head>
        <body>


              <div class="container">
        <div class="row">
               <div class="col-xs-8">
              <h1> <span class="label label-default">Select Consellors</span></h1>
               </div>
            </div>
        </div><br><br>

        <div class="container">
        <form action="#" method="post" enctype="multipart/form-data">
        <input type="hidden" name="command" id="command" value="date_assign"/>






            <div class="row">

             <label class="col-xs-2">Select Date</label>
                <div class="col-xs-3">
                    <input type="text" name="c_dob" id="c_dob" class="form-control" value="DD-MM-YYYY" required>

                </div>
            </div>
                 <br>

                 <div class="row">
                 <div class="col-xs-4">
                 </div>
                 <div class="col-xs-1">
          <input type="button" class="form-control" id="left" value="<"  />
                </div>
                        <div class="col-xs-1">
                              <input type="button" class="form-control" id="right" value=">" />
                         </div>
                         <div class="col-xs-1">
          <input type="button" class="form-control" id="leftall" value="<<" />
                         </div>
                              <div class="col-xs-1">
          <input type="button" class="form-control" id="rightall" value=">>" />           
                         </div>


                </div>
                <br>
                <div class="row">
                <label class="col-xs-3">Tea Break Break Duration</label>
                <div class="col-xs-1">

              <div class="inner cover indexpicker">

            <input id="timepicker" type="text" name="timepicker" class="form-control" readonly/>

              </div>             

                </div>

             <label class="col-xs-1">From</label>
                <div class="col-xs-3">

              <div class="inner cover indexpicker">

            <input id="timepicker1" type="text" name="timepicker1"  class="form-control"/>

              </div>             

                </div>

                <label class="col-xs-1">To</label>
                <div class="col-xs-3">

              <div class="inner cover indexpicker">

            <input id="timepicker2" type="text" name="timepicker2" class="form-control" />

              </div>             

                </div>

            </div>







        <br>

                              <div class="row">
                             <div class="col-xs-5"></div>

                             <div class="col-xs-5">

                            <button type="submit" id="submitform1" name="submitform1" class="btn btn-primary">Submit</button>

                             </div>

                             </div>     



        </form>
       </div>



       <div class="container-fluid">
    <?php include("include/footer.php");  ?>
    </div>
          <script src="js/jquery.min.js"></script>
          <script type="text/javascript" src="js/bootstrap-fileinput.js"></script>

            <script src="js/bootstrap.min.js"></script>
            <script src="js/jquery-1.10.2.js"></script>
            <script src="js/jquery-ui.js"></script>

            <script src="js/bootstrap-datepicker.js"></script>
                <script src="js/timepicki.js"></script>

            <script>





    </script>


        <script>
      $(function() {
        $( "#c_dob" ).datepicker({
          defaultDate: "+1w",
          changeMonth: true,
          numberOfMonths: 1,
          onClose: function( selectedDate ) {
            $( "#to" ).datepicker( "option", "minDate", selectedDate );
          }
        });

      });
      </script>

       <script>
            function moveItems(origin, dest) {
        $(origin).find(':selected').appendTo(dest);
    }

    function moveAllItems(origin, dest) {
        $(origin).children().appendTo(dest);
    }

    $('#left').click(function () {
        moveItems('#sbTwo', '#sbOne');
    });

    $('#right').on('click', function () {
        moveItems('#sbOne', '#sbTwo');
    });

    $('#leftall').on('click', function () {
        moveAllItems('#sbTwo', '#sbOne');
    });

    $('#rightall').on('click', function () {
        moveAllItems('#sbOne', '#sbTwo');
    });
            </script>

            <script type="text/javascript">

    $(document).ready(function(){

    $


        });

    </script>
     <script>
        $('#timepicker1').timepicki();
        </script>

         <script>
        $('#timepicker2').timepicki();
        </script>




        </body>
        </html>






I am facing problem on change event. value is getting after submit the form but i want after selecting two times difference minutes getting into text box using on change event. but not working. any body help me getting difference minutes inside the form into text box. 

Edited by diafol: wrong forum

3
Contributors
2
Replies
20
Views
2 Years
Discussion Span
Last Post by diafol
0

Hi Ramsiva, this seems more like a Javascript question then a PHP question. If still relevant, I would suggest migrating this question there.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.