Pages

Jquery JS add html code into a div if empty

<script>
    
    $(document).ready(function(){
       
       function isEmpty( el ){
      return !$.trim(el.html())
  }
  if (isEmpty($('#showvacnt'))) {
     
     $('#showvacnt').append("TEXT GOES HERE.");
     
  }

    });

</script>

php keep form values after submit

<input id="user_name" type="text" pattern="[a-zA-Z0-9]{2,64}" name="user_name" required class="form-control" value="<?php if(isset($_POST['user_name'])) { echo htmlentities ($_POST['user_name']); }?>" />

PHP Display date and time now according to your country (Server time change)

<?php 
       
date_default_timezone_set('Asia/Colombo'); //your country region

http://php.net/manual/en/timezones.php

$timenow = date('H:i:s', time());

$datenow = date('Y-m-d');

?>

Search This Blog