Q:

laravel read a checkbox value in a controller

This is my html blade code
{{Form::checkbox('remember_me', '', array('id'=>'remember_id'))}}
        <label for="remember_id">Remember me</label>

This is my controller code:
 echo Input::get('remember_me');exit;

The result is always empty, why please?
The checkbox is always checked when I run the page, why please?

Thanks

A:

Please have a look on the [parameter list of the Form::checkbox() method][1]. 
The second parameter is your checkbox value. You manually set it to an empty string. Set it to null in order to keep the browsers default values (laravel default is 1). The third parameter is a boolean. Set it to true to check the box and false to uncheck it.
The fourth parameter is your options array where you can specify your id. So the correct method call should be:
{{Form::checkbox('remember_me', null, false, array('id'=>'remember_id'))}} 

Update:
Checkboxes that are not checked, will not be included in your POST data. So the only reliable way to verify that a checkbox has been checked is to check if it is set. That can be done using isset() with regular PHP functions, or if laravel is being used, by using Input::has() which returns a boolean dependent on whether your input data contains a given key.

