Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

How could we read the checkbox values from .volt to .controller

Hi. In Phalcon I am using .volt for view purpose. In that I have the multiple checkboxes. How could I read the checkbox vlues from .volt to .controller fie?


with ajax request ?

your question is a bit odd.

the controller displays the view and thats it, there is link between a view and controlller in that direction ?

Actually from View I am getting values to the Controller (By $this-request-getPost('')) but when I am trying to get the multiple checkbox values from a form I am unable to get all the values from view controller( and Here I would to know that how could we check whether checkbox is checked (or) not in controller).

Hope this give more clarity of my question. Thank you


you are right, there is a link in that direction, i am dumb.

but i still dont understand the idea what you are trying to do.

user enters a url -> controller ( we pick a view here, we do some queries maybe ? ) -> we display the view

so user didnt have an option to click any checkboxes yet ?

for more clarity below is the code I used in form

{{ check_field( 'name':'myClass', 'data-size':'big', 'id':'id', 'value' }}

the above one is in loop. Now how could I get the all the checkbox details in controller. In controller I am using $_REQUEST('myClass') I am getting only once check box info but not all the checkboxes info. I need to get all checkboxes info.

Thank you

If your checkbox name in same name, you can try like this

In View Volt :

{% for category in categories %}

<input type="checkbox" value="{{ }}" name="category[]">

{% endfor %}

In Controller :


foreach ($cats as $cat){

echo $cat;


Thank you Izo and Aditya Y Pradhana . Yes you guyss are right for name paramter I need to give the '[]'. '{{ check_field( 'name':'myClass[]', 'data-size':'big', 'id':'id', 'value' }}'

Now I am getting the values as array. Thanks for your help friends :)