too long

All code is working but i need help in Timezone.. How to use Timezone In this Query ?

public function res_openandclose($res_id,$time_open,$time_close)
    {
        $db=getDB();
        $timezone = '<span class="timezone"></span>';
        date_default_timezone_set($timezone);
        $stmt = $db->prepare("SELECT * FROM  fooddelivery_restaurant  WHERE id=:res_id AND CURTIME() >= :open_time and CURTIME() <= :close_time ");
        $stmt->bindParam("res_id", $res_id, PDO::PARAM_STR);
        $stmt->bindParam("open_time", $time_open, PDO::PARAM_STR);
        $stmt->bindParam("close_time", $time_close, PDO::PARAM_STR);
        $stmt->execute();
        $count = $stmt->rowCount();
        if($count)
        {
            return "open";
        }
        else
        {
            return "closed";
        }
    }

You cannot take values from DOM elements which are dynamically set by Javascript. You will need to use a combination of jQuery + AJAX + PHP.

I'll make a few assumptions:

  1. Your PHP file is called "process.php"
  2. Your HTML document (in which <span class="timezone"></span> is contained) is called form.php
  3. Even though I'm not a fan of including jQuery/Javascript in form.php, for ease of this answer I'll include it anyway.
  4. The timezone set by Javascript follows the regular format found at: http://php.net/manual/en/timezones.php

In this case please try the following:

STEP ONE:

If not already included, include jQuery in the header of form.php. You can copy/paste this in the header of form.php:

<script
  src="https://code.jquery.com/jquery-3.3.1.js"
  integrity="sha256-2Kok7MbOyxpgUVvAk/HJ2jigOSYS2auK4Pfzbm7uH60="
  crossorigin="anonymous"></script>

STEP TWO

Include the following in the BODY of your document, but right before the </body> closing tag:

<script>
$(document).ready(function() {  
        "use strict";
        var TimeZone = ($(".timezone").html());

        $.ajax({
            type: "post",
            dataType: "html",
            url: "process.php",
            data: {Purpose : "CallFunction", Function: "res_openandclose", TimeZone : TimeZone},
            success: function (response) 
                {
                      alert(response); //will alert either "open" or "closed"
                }
        });
    });//end function
</script>

STEP THREE

Modify your process.php to reflect the following

//Receive Parameters from AJAX for Function Calls
if(isset($_POST["Purpose"]) && $_POST["Purpose"] === "CallFunction") {

    if(isset($_POST["Function"]) && $_POST["Function"] === "res_openandclose") {
        res_openandclose($res_id,$time_open,$time_close);
    }//end if

}//end if

    public function res_openandclose($res_id,$time_open,$time_close)
        {
if(isset($_POST["TimeZone"]) {
$timezone = $_POST["TimeZone"];
            $db=getDB();
            date_default_timezone_set($timezone);
            $stmt = $db->prepare("SELECT * FROM  fooddelivery_restaurant  WHERE id=:res_id AND CURTIME() >= :open_time and CURTIME() <= :close_time ");
            $stmt->bindParam("res_id", $res_id, PDO::PARAM_STR);
            $stmt->bindParam("open_time", $time_open, PDO::PARAM_STR);
            $stmt->bindParam("close_time", $time_close, PDO::PARAM_STR);
            $stmt->execute();
            $count = $stmt->rowCount();
            if($count)
            {
                return "open";
            }
            else
            {
                return "closed";
            }
        }

Save all files and run the script.

Here it is

public function res_openandclose($res_id,$time_open,$time_close, $time_zone)
{
    $db = getDB();

    $stmt = $db->prepare("SELECT * FROM  fooddelivery_restaurant  WHERE id=:res_id AND CURTIME() >= :open_time and CURTIME() <= :close_time and timezone = :time_zone");

    $stmt->bindParam("res_id", $res_id, PDO::PARAM_STR);
    $stmt->bindParam("open_time", $time_open, PDO::PARAM_STR);
    $stmt->bindParam("close_time", $time_close, PDO::PARAM_STR);
    $stmt->bindParam("time_zone", $time_zone, PDO::PARAM_STR);
    $stmt->execute();
    $count = $stmt->rowCount();
    if($count){
        return "open";
    }
    else{
        return "closed";
    }
}