I form field is blank then show error message and form does not submitted : I am trying to create a Api.I am trying to submit a form . Form is submitted and response message after form submission is Ok .but I am trying to  validate this form  if any filed is blank then form does not submitted and show validation message.

    <?php
    require('../../../../wp-blog-header.php');
    header("HTTP/1.1 200 OK");
    global $wpdb;
    global $serverUrl;
    global $current_user;
    $id =isset($_REQUEST['store_id']) ? $_REQUEST['store_id'] : '';
    $user_id =isset($_REQUEST['user_id']) ? $_REQUEST['user_id'] : '';
    $unit_data = isset($_REQUEST['unit_data']) ? $_REQUEST['unit_data'] : '';
    $product = isset($_REQUEST['product']) ? $_REQUEST['product'] : '';
    $checked_by = isset($_REQUEST['checked_by']) ? $_REQUEST['checked_by'] : '';
    $username = isset($_POST['username']) ? $_POST['username'] : '';
    $option = "signup";
    
    $data = array(  
            'store_id' =>$id,   
    	'user_id' =>$uid,
    	'unit_data' =>$unit_data,
            'category_name'=>'delivery_form',
            'checked_by'=>$checked_by,
            'product' =>$product, 
            'suppliers'=>$suppliers,
            'username' =>$username,
    	);
    $insert=$wpdb->insert('diary_user_form_storage', $data);
            echo json_encode(
                array(
                    "status" => "1",
    				'user_id' =>  $user->ID,
                                    'message' => 'Data submitted',
    				"token" => $token,		
    				'token' => $token.$device_id.$device_type,
    				'serverUrl' => $serverUrl,	
      $data = array(  
            'store_id' =>$id,   
    	'user_id' =>$uid,
    	'unit_data' =>$unit_data,   
            'product' =>$product,
           'suppliers'=>$suppliers,
            'checked_by'=>$checked_by,
            'username' =>$username,
            'option'=>$option
    	)
        ));
        exit();
     
       

 ?>