Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8126535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T07:10:55+00:00 2026-06-06T07:10:55+00:00

I am trying to create a report that can be filtered using a form

  • 0

I am trying to create a “report” that can be filtered using a form on the top of the page. The options to filter the results is the Fiscal Year which is the current FY by default and multiple categories (check boxes) which are all checked by default. The page generates properly with the default data but when the form is submitted the page will “refresh” but there is no POST data generated. I tried creating a copy of the page and setting it as the action URL but it still did not have any POST data and used the defaults. I will include my code below and will try to narrow it down to just the necessary parts to make it easier but can share all of it if need be. Thank you in advance for any help offered.

<body>
    <?php 
    if(isset($_POST['submit'])){echo"SET";} else{echo"NOT SET";}
// Establish Connection and Variables       
// Connection   
        include "./include/class/DBConnection.php";
        DBConnection::$dsn;
        DBConnection::$user;
        DBConnection::$pass;
        DBConnection::getDBConnection();
// The Current Fiscal Year
        $today = getdate();
        $month = $today['month'];
        // seperate first and second half of fiscal year
        $old = array('January','February','March','April','May','June');    
        if (in_array($month,$old)) {
            $year = $today['year'] + 1;
        }
        else {
            $year = $today['year'];
        }                       
// Create SQL Query Variables - Removed for post
// Set filter criteria
// Retrieve array of possible categories and create SQL WHERE statment  
        $catAllCxn = DBConnection::$cxn->prepare($SQL_Categories);
        $catAllCxn->execute();
        $catAllCxn->setFetchMode(PDO::FETCH_ASSOC);
        $catAllArray = array();
        while($catAllRow = $catAllCxn->fetch()) {
            $cat = $catAllRow['Category'];
            array_push($catAllArray, $cat);
        }
        $catAllInQuery = implode(',',array_fill(0,count($catAllArray),'?'));
// Create array for category filter IF form was submitted to itself
        if (isset($_POST['submit'])){  // if page is submitted to itself

            $catFilterArray = $_POST['Category'];
            $catFilterInQuery = implode(',',array_fill(0,count($catFilterArray),'?'));

        }
// Switch for ALL or Filtered report
        if(!isset($_POST['submit'])) { // if page is not submitted to itself 

            $FiscalYear = $year;
        //  $DiscludedDepartmentNumbers = "21117";
            $catArray = $catAllArray;
            $IncludedCategories = $catAllInQuery;
        }
        else {
            $FiscalYear = $_POST["FiscalYear"];
        //  $DiscludedDepartmentNumbers = "21117";
            $catArray = $catFilterArray;
            $IncludedCategories = $catFilterInQuery;
        }               
    ?>
<!-- Filter Form -->        
    <div id="filters" style="border: 1px solid;"> 
        <form name="filter" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" method="POST"> 
            Fiscal Year: <input type="text" name="FiscalYear" value="<?php echo $FiscalYear; ?>" /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php if(isset($_POST['submit'])){echo"SET";} else{echo"NOT SET";}?>
            <br />
            <fieldset>
                <legend>Select Categories</legend>
                <?php 
                    foreach($catAllArray as $catAllRow) {
                        if (!isset($_POST['submit'])) {
                            echo "<input type=\"checkbox\" name=\"Category\" value=\"".$catAllRow."\" checked=\"checked\" />".$catAllRow."&nbsp;&nbsp;\n";
                        }   
                        else if(in_array($catAllRow,$catArray)) {
                            echo "<input type=\"checkbox\" name=\"Category\" value=\"".$catAllRow."\" checked=\"checked\" />".$catAllRow."&nbsp;&nbsp;\n";
                        }
                        else {
                            echo "<input type=\"checkbox\" name=\"Category\" value=\"".$catAllRow."\" />".$catAllRow."&nbsp;&nbsp;\n";
                        }   
                    }   
                ?>
            </fieldset> <br />
            <input type="submit" value="submit" />
        </form> <!-- End: filter -->
    </div>  <!-- End: filters -->

From here the original code continues to output results into a table but this works properly and I don’t think it is the problem. I can share more if asked.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T07:10:56+00:00Added an answer on June 6, 2026 at 7:10 am

    You need to give the submit button a name, if that’s what you’re using to check if the form is submitted…

    <input type="submit" value="submit" name="submit" />
    

    Or if you dont want to change the submit button, you can check isset on the category input instead

    if(isset($_POST['Category'])){echo"SET";} else{echo"NOT SET";}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a report that has a summary for each group.
I'm trying to create a report that needs to get the dates for last
I'm trying create a bot which automatically likes Facebook posts. Using Mechanize I can
I am trying to find a way to create a report in BIRT that
I am trying to create a crystal report and I am new to that
I am trying to create a report using BIDS. I want one of the
I'm trying to produce a report that shows, for each Part No, the results
I am trying to create a report using the mongo connector on iReport designer
I'm trying to create a report that allows the user to select not only
I am trying to create a set using MDX that contains a CASE statement.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.