如何在PHP中使用HTML表单获取当前时间

Hello everybody, Once I click Submit button I want to display hour with seconds in HTML form using PHP. Can anyone tell how to do it?

Just as example you can try the following code and for more details about time in

  <?php
  if($_REQUEST['submit'])
  {
   echo "Today is " . date("Y/m/d") . "<br>"; // Today is 2016/11/26
   echo  "Time is" . date("h:i:sa"); // prints the time
  ?>
  <!-- To display time in textarea you can use the following code -->
 <textarea><?php echo date("h:i:sa"); ?></textarea>
<?php } ?>

<form action="" method="get">
  <textarea><?php echo date("h:i:sa"); ?></textarea>
  <input type="submit" name="submit" value="Show Time" />

</form>

Please note that you should save the file with .php extension

 <?php
  $datetime = '';
  if(isset($_REQUEST['submit']))
   {

    $datetime = date("h:i:sa");
  }
 ?>

 <form method="POST">
 <textarea><?php echo $datetime; ?></textarea>
 <input type="submit" name="submit" value="Show Time" />

 </form>
?>