Answers for "checkbox condition laravel"

PHP
2

laravel checkbox terms and conditions

<form action="/checkbox-example" method="POST">
        @csrf
        <label>Your Name</label>
        <input type="text" name="name"/><br/><br/>
        <input type="checkbox" name="terms">
        <label>Do you agree to Terms & Conditions</label><br/><br/>
        <button type="submit">Submit</button>
 </form>
Posted by: Guest on August-25-2021
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

Code answers related to "checkbox condition laravel"

Browse Popular Code Answers by Language