I want to have a simple calendar system on a form to choose a start and end date. This date needs to be passed to an SQL query that will limit the results of the query.
The form also has a bunch of checkboxes (works well) to select columns and various other things..
I found a calendar that should work:
but I can't seem to get the date out of the $_POST array, even though I know it is being passed properly to $_POST.
In the code below I have the code that should be putting the start date in to a variable (?) ($smalldate) and the end date into $bigdate.
When I var_dump var_dump($_REQUEST); I get an array, and when I var_dump($bigdate); I get NULL.
I am totally open to using a different method altogether. I need to have a easy input for dates, ie I don't want the user to have to enter a date manually but rather have the ability to choose with the mouse.
I would like to have the start and end dates end up in something I can use in my SQL query like this:
e` < '$bigdate' AND `datavalues`.`LocalDateTim
e` > '$smalldate'";
# This is my query page (part of it)
<form method="post" action="result.php" name="searchform">
//get class into the page
//instantiate class and set properties
$myCalendar0->autoSubmit (true, "searchform");
$myCalendar1->autoSubmit (true, "searchform");
//output the calendar
echo " to ";
# The submit button and end of the form are lower down but not shown here.
# This is in result.php
$smallDate = isset($_REQUEST["date0"]) ? $_REQUEST["date0"] : "";
$bigDate = isset($_REQUEST["date1"]) ? $_REQUEST["date1"] : "";
var_dump($_REQUEST); # returns an array
var_dump($bigdate); #returns "NULL"
echo $_POST["date0"]; # seems to give me the result I want "2008-01-01"