Hello Everyone,
I hope someone can help me here.
I have a chart and I am trying to add a WHERE clause in the Before SQL Query events page but for some reason it is not working for me. I added two inputs in the htm page so that the user can enter a date range to filter the results with the where clause but for some reason i can not get the range date from the user. i have a form and i tried with POST, GET and REQUEST and none of them worked. here is the code hopefully someone can help me
//code on html page
<FORM method=get name=sub_date
action="">
<TABLE style="WIDTH: 735px; HEIGHT: 40px" border=1 cellSpacing=1
cellPadding=1 width=735>
<TBODY>
<TR>
<TD style="WIDTH: 668px" colspane="2"><B><FONT size=2
face=Arial>Select Date range</FONT></B> <INPUT
id=start_date onclick="scwShow (scwID('start_date'), event);"
name=start_date> <IMG onclick="scwShow (scwID('start_date'), event);" alt=calendar src="images/cal.gif" width=16 height=16> <FONT size=2
face=Arial><B>to </B></FONT><INPUT id=end_date
onclick="scwShow (scwID('end_date'), event);" name=end_date> <IMG onclick="scwShow (scwID('end_date'), event);" alt=calendar src="images/cal.gif" width=16 height=16> <INPUT name=submitted
value=1 type=hidden> <INPUT name=submit value=Submit type=submit></TD></TR></TBODY></TABLE></FORM>
//code on the events page
if($_GET['submit'] == 'Submit'){
$arr_one = explode("/",$_GET['start_date']);
$arr_two = explode("/",$_GET['end_date']);
$start_date = $arr_one[2]."-".$arr_one[0]."-".$arr_one[1];
$end_date = $arr_two[2]."-".$arr_two[0]."-".$arr_two[1];
}
else{
$start_date = date('Y-m')."-01";
$end_date = date('Y-m-d');
}
$strWhereClause = whereAdd($strWhereClause, "expedientes.date_added BETWEEN '".$start_date."' AND '".$end_date."'");
it always shows the current month even after submitting the range date.. and the values are going through because i can see them on the URL
Cask__Amount_chart.php?start_date=04%2F01%2F2012&end_date=04%2F30%2F2012&submitted=1&submit=Submit
Thanks for your help