elentz Posted August 6, 2008 Share Posted August 6, 2008 First Thanks for even looking. Here's my code <!-- .head1 {background: #CC9933; height:32px; color: #FFFFFF; font-size: 10pt; font-weight: 500=medium; text-align: center} .sub1 {background: #C8B588; height:22px; color: #FFFFFF; font-size: 9pt; font-weight: 500=medium; text-align: center} .data1 {background: #ffffCC} .data2 {background: #ffffCC} /* End of style section. Generated by AceHTML at 16/08/03 10:14:34 */ --> </head> </style> <script language="javascript" type="text/javascript" src="datetimepicker.js"> </script> <BODY> <H4>Paid Invoice Report </h4> <H4>Enter the Start and End dates for the report.</h4> <H4>Press the Submit Button to get the report.</h4> <h4></h4> <form action="/customstuff/reports/paidinvoicereport.php" method=POST> Report Start Date:<input id="date1" type="text" size="25"><a href="javascript:NewCal('date1','mmddyyyy')"><img src="/cal.gif" width="16" height="16" border="0" alt="Pick a date"></a> Report End Date:<input id="date2" type="text" size="25"><a href="javascript:NewCal('date2','mmddyyyy')"><img src="/cal.gif" width="16" height="16" border="0" alt="Pick a date"></a <input type="submit" /> </form> </BODY> </html> This html (i hope) will collect a starting date and an ending date using a JS I found, and it does put it into the text boxes. When I hit the submit button the dates are not passed to the next page below: $start=$_POST['date1']; $end=$_POST['date2']; echo $start; echo $end; //******Query to get the Invoice information************* $sql = "SELECT vtiger_invoice.invoice_no, vtiger_invoice.invoicedate, vtiger_account.accountname, vtiger_invoicecf.cf_614, vtiger_invoicecf.cf_618, vtiger_invoice.total, vtiger_invoicecf.cf_532, vtiger_invoicecf.invoiceid, vtiger_invoicecf.cf_674 FROM vtiger_invoice Inner Join vtiger_account ON vtiger_invoice.accountid = vtiger_account.accountid Inner Join vtiger_invoicecf ON vtiger_invoice.invoiceid = vtiger_invoicecf.invoiceid WHERE vtiger_invoice.invoicestatus = 'Paid' AND Month(vtiger_invoicecf.cf_674) between '$start' and '$end' ORDER BY vtiger_invoicecf.cf_674 ASC"; If I were to manually insert dates into the Query the second page shows me what I want to see. What is not happening is the passing of the date1 and date2 data. The echo I have never shows anything. Where have I gone wrong here? Thanks Ed Quote Link to comment Share on other sites More sharing options...
papaface Posted August 6, 2008 Share Posted August 6, 2008 <input id="date1" Should be: <input name="date1" Quote Link to comment Share on other sites More sharing options...
elentz Posted August 6, 2008 Author Share Posted August 6, 2008 well, changing the id to name worked somewhat. The js calendar that I was using to make the entry quit working. When I entered the date manually it all works fine. Any other suggestions? Thanks Quote Link to comment Share on other sites More sharing options...
lemmin Posted August 6, 2008 Share Posted August 6, 2008 You can have both: <input id="date1" name="date1" Quote Link to comment Share on other sites More sharing options...
elentz Posted August 6, 2008 Author Share Posted August 6, 2008 Thanks alot to both it is working almost perfectly. With a little exception. Using th date picker I am using I get an unexpected result in my query. lets say I use the date picker to pick 06-15-2008 (june 15, 2008) and the second date is 08-01-2008 (Aug 1, 2008) I get all the records for the month of june , july and what there is of Aug. The records come up from June 1 to 15 as well. How come? Anyone know? Thanks Quote Link to comment Share on other sites More sharing options...
lemmin Posted August 6, 2008 Share Posted August 6, 2008 Because you are checking the criteria for the month not the day. I don't know what SQL uses that function so I probably can't help with it, but is there a day function similar to the month one? Quote Link to comment Share on other sites More sharing options...
elentz Posted August 6, 2008 Author Share Posted August 6, 2008 DOH! I am only using the Month function of the query!!! That makes sense now! It is OK tho most of the reports I want to make will be for a whole month anyway. Thanks everyone for all the help! Quote Link to comment Share on other sites More sharing options...
elentz Posted August 6, 2008 Author Share Posted August 6, 2008 OOPS I forgot to answer your question. I did see that there is a function to use the day and not the month. I might decide to use that anyway. Thanks again ! Quote Link to comment Share on other sites More sharing options...
papaface Posted August 6, 2008 Share Posted August 6, 2008 You can have both: <input id="date1" name="date1" Yeah you can, in actual fact "id" is the correct way to do it in valid HTML I believe, but PHP only accepts the elements with the name attribute (as far as I am aware anyway). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.