如何在特定时间检查时间,然后执行操作

I already have time function and already be able to check its at the time I want then It will change value of the input text;

HOWEVER, when I try to do the action, it would not work.

I have time function here then if the time is at 2:30:35 PM then text value change to 1

if(buff=="2:30:35 PM")
{document.getElementById("text").value = 1;}

BUT when I want to check if the value of the text is 1 it would not do the action.

<input id= "text" name="test" type="text" value="">
<?php
if (isset($_GET['test']))
{
  $link = mysql_connect(DB_HOSTNAME,DB_USERNAME,DB_PASSWORD) or die("Could not connect to host.");
  mysql_select_db(DB_DATABASE, $link) or die("Could not find database.");
  $query = "UPDATE table SET something='0'";
  $result = mysql_query($query, $link) or die("Data not found.");
}
?>

I would do it like this

//mktime(hour,min,sec,month,day_of_month,year); returns time() value for that date/time
if (time() < mktime(14,30,35,date('n'),date('j'),date('Y'))) {
    //This will run if its earlier then 2:30:35 PM
    //do smth
}
if (time() > mktime(14,30,35,date('n'),date('j'),date('Y'))) {
    //This will run if its later then 2:30:35 PM
    //do smth
}

Sources:

http://www.php.net/manual/en/function.date.php

http://www.php.net/manual/en/function.mktime.php