根据当前系统时间自动生成输入值

I am creating a production recording system. What I want is that to automatically generate the input in "hour" based on the current system time. For example if the system time is in between 7.00 am and 7.15 am, the "hour" should be 1.Like that it should continue. I have written the following code but seems like it is wrong.Can anyone give me suggestions for that?

<?php
      $sql="SELECT CURTIME() AS Time";
      $result=mysqli_query($conn,$sql);
      while($row = mysqli_fetch_array($result)){
      $time=$row['Time'];

    }
    if("07:00:00"<="$time"<="07:15:00"){
  echo "<input class='form-control' type='text' name='hour' value='1' readonly >";

    }
       ?> 

It's probably easiest to manipulate times using timestamps. You can set the start and end times and then do a simple conditional to display the form element you want to display.

$current_time = time();
$start = strtotime("07:00:00");
$end = strtotime("07:15:00");

if ($current_time > $start && $current_time < $end)
{
   echo "<input class='form-control' type='text' name='hour' value='1' readonly >";
}

I found another solution which helped me

<?php

 date_default_timezone_set("Asia/Colombo");
 $current_time=date('H:i:s', time());

 $time1 ="06:00:00";
 $time2 ="07:15:00";

 if ($current_time > $time1 && $current_time < $time2)
      {
      echo "<input class='form-control' type='text' name='hour' value='1' readonly >";
      }
  <?