troubleshooting Question

Filtering by Date

Avatar of David Schure
David Schure asked on
2 Comments1 Solution20 ViewsLast Modified:
I am trying to filter a report based on the month from a select box.
The query for the report
$sql = <<<EOT
    SELECT DATE_FORMAT(tbl_session.session_date,"%W, %M, %d, %Y") AS DATE, 
   TIME_FORMAT(CONCAT(tbl_session.time_slot_id, ":00:00"), "%h:%i %p") AS TIME,
   tbl_session.session_type AS TYPE, tbl_therapist.therapist_name as THERAPIST, tbl_session.session_status AS STATUS
    FROM tbl_session
    INNER JOIN tbl_therapist
    ON tbl_therapist.therapist_id=tbl_session.therapist_id
   WHERE tbl_session.client_id=$client_id
AND tbl_session.session_date = (NOT SURE WHAT GOES HERE)
    ORDER BY session_date DESC;
$result = $db->query($sql);
The selectbox
<form action="monthselect.php">
  <label for="monthly">Select a Month</label>
  <select name="monthly" id="monthly">
     <option value="All">Show All</option>
    <option value="Jan">January</option>
    <option value="Feb">February</option>
    <option value="Mar">March</option>
    <option value="Apr">April</option>
    <option value="May">May</option>
    <option value="Jun">June</option>
    <option value="Jul">July</option>
    <option value="Aug">August</option>
    <option value="Sept">September</option>
    <option value="Oct">October</option>
    <option value="Nov">November</option>
    <option value="Dec">December</option>
   <input type="submit" value="Submit"> 
I know I need to add an Ajax script and populate the monthselect.php file.  Not sure how.
      $('select[name=monthly]').on('change', function() {

    let selectedValue = $(this).val()
        url : 'monthselect.php',
        data : { client : selectedValue },
    }).done(function(response) {

Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros