iso.obj.php
$from = null;
$too = null;
if (isset($_POST['search'])) {
if ($from = null) {
$from = date("Y-m-d");
} else {
$from = $_POST['FromDateTime'];
}
if ($too = null) {
$too = date('Y-m-d', strtotime("+30 days")) . " 23:59:59";
} else {
$too = $_POST['ToDateTime']." 23:59:59";
}
}
$sql ="//statement here with
WHERE capDateTime >='{$from}' AND capDateTime <='{$too}'";
The code is working fine but i got problem when person request the page and its return an empty table. But if i select date and time manualy its will display according to the date and time.
My question is: How do i put current date if not set and if set follow the $_POST?
if ($too = null) {you are assigning the values not comparingif ($from === null) {andif ($too === null) {if ($too = null) this ---> =is an assignment operator. If you want to compare it use==comparison operator. See here.