KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

POST Internal server error #1328

Closed Cleitao opened this topic on on Mar 3, 2020 - 2 comments

Cleitao commented on Mar 3, 2020

Hi, When I use the calendar example provided the server replies : POST [HTTP/1.1 500 Internal Server Error 45ms]

Thank you for your help, CL

Pagamento2.php

<?php
    require_once "koolreport/core/autoload.php";

    use \koolreport\KoolReport;
    use \koolreport\processes\Group;
    use \koolreport\processes\Sort;
    use \koolreport\processes\Limit;
    use \koolreport\inputs\DateTimePicker;

    class Pagamento2 extends \koolreport\KoolReport
    {

        use \koolreport\inputs\Bindable;
        use \koolreport\inputs\POSTBinding;
        use \koolreport\clients\Bootstrap;

        protected function defaultParamValues()
        {
            return array(
                "startDatePicker"=>date("Y-m-d"),
            );
        }

        protected function bindParamsToInputs()
        {
            return array(
                "startDatePicker",
            );
        }
        public function settings()
        {
            return array(
                "dataSources"=>array(
              // blanked
                    )
                )
            ); 
        }

        public function setup()
        {
            $this->src("controleDB")
            ->query("
              // blanekd
            ->pipe($this->dataStore("Facturas"));

        }
    }
    $pagamento = new Pagamento2;
    $pagamento->run()->render();

Pagamento2.view.php

<html>
    <head>
        <title></title>
    </head>
    <body>
    <?php 
        use \koolreport\inputs\DateTimePicker;
        use \koolreport\widgets\koolphp\Table;
    ?>
    <div class="report-content">
        <div class="text-center">
            <h1>Facturas a pagamento</h1>
        </div>
        <form method="post">
            <div class="row">
                <div class="col-md-3">
                    <strong>DateTimePicker</strong>
                </div>
                <div class="col-md-6">
                    From Date:
                    <?php
                        DateTimePicker::create(array(
                        "name"=>"startDatePicker",
                   //     "maxDate"=>"@endDatePicker",
                        "format"=>"MM/DD/YYYY",
                        "themeBase"=>"bs4",
                    ));
                    ?>
                </div>
            </div>
             <div class="form-group" style="margin-top:30px;">
                <button class="btn btn-lg btn-primary">Submit form</button>
            </div>
            <p class="form-group">
            <i>* Please try to change form and submit, you will see the form
            values are persistent through form post. Below are values that archived from <code>$params</code>
            </i>
            </p>      
            <pre><code><?php echo json_encode($this->params,JSON_PRETTY_PRINT) ?></code></pre>
        </form>
    </div>
</body>
</html>
KoolReport commented on Mar 3, 2020

You should not add the report initiation inside the controller class. Better to remove those line of code and move the another file like index.php

    $pagamento = new Pagamento2;
    $pagamento->run()->render();

Second, please try to use error_reporting(E_ALL); function to turn on the reporting so that you know what went wrong. The error 500 is general and normally used in production server where you want to hide the error.

Cleitao commented on Mar 13, 2020

Thank you for your help, error_reporting did the trick

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
help needed

Inputs