How can I access POST params send from a view in the controller?


i am currently developing a module for icingaweb2. I am submitting a select in a partial view via onchange=“this.form.submit()”. The action of the form refers to the same site the view is on, meaning the controller should be able to get the POST params. I then try to see the POST params in my controller via var_dump($_POST); But this always returns an empty array. What am i missing here? Any help is appreciated.

Michel W.

Have a look here for an example :

Don’t do this. There’s a better alternative:

<select class="autosubmit">

Then, Icinga Web 2 automatically submits the form once the user interacts with the drop-down. On the server-side you may even distinguish between a proper submit (manual button push) or such an autosubmit.

Though, to get the most out of it, make sure to use Icinga\Web\Form to build and process your form.

1 Like