如何验证datepicker是否为空

How to check if the $dateStart and $dateEnd is empty?

<?php
if (isset($_POST['submit'])) {
       $leaveR = $_POST['leave'];
       $dateStart = $_POST['startDate'];
       $dateEnd = $_POST['endDate'];
       $leaveReason = $_POST['reason'];
       $credits = $_POST['credit'];
       $oic = $_POST['oicc'];
       if ($leaveR == "" || $dateStart == "" || $dateEnd == "" || $leaveReason == "" || 
           $credits == "" || $oic == "") {
          echo '<div class="alert alert-danger" role="alert">Fill up all fields</div>';

This partly depends on your javascript code. Is the datepicker defaultly set to the current date or "0000-00-00" for example. Or does it simply return blank.

Comprehensive answer without knowing your javascript initiation of datepicker:

if( isset( $_POST['startDate'] ) && trim( $_POST['startDate'] ) !== "" && trim( $_POST['startDate'] ) !== "0000-00-00" || !isset( $_POST['startDate'] ) ) { 
    // do something
}