Answers for "laravel selected checkbox to string"

PHP
0

laravel checkbox checked

//You should write a value in the checkbox and then check if that value is null or not:

//HTML, in form:
<input id="check" type="checkbox" name="check" value="check">

//PHP, in controller:
$isChecked = $request->check != null;

//If the checkbox is checked, then the $request->check will not be null. Otherwise, it will.
//Then the $isChecked variable will be true if the checkbox is checked, and false if it isn't.
Posted by: Guest on December-18-2021
1

update checkbox value in laravel

in controller : $shop= shop::find($request['id']); $shop->update($request->all()); In edit mode When I checkbox true work correctly but when I unchecked checkbox dose not work
Posted by: Guest on May-31-2021

Browse Popular Code Answers by Language