1

I recently using Laravel version 5.8, now I am little confused about how to input checkbox value to the table in the database, the checkbox value always return null, even the checkbox is selected, can anyone help me with this by the way, this is my form checkbox

    <form action="{{ $siswa->id_siswa}}/verifikasi">
    @csrf
    <label for=""><input type="checkbox" name="ijazah" id="" value="true">ijazah</label>
   </form>

and this is my function in the controller

    public function approve(Request $request,$id_siswa){
    $ijazah = $request->ijazah;
    dd($ijazah);
    }
2
  • 1
    You need to get the data of the input like this: $request->input('ijazah'); Commented Jun 11, 2020 at 3:34
  • @ettdro, yeah thanks my friend, it's like your advice Commented Jun 11, 2020 at 4:13

1 Answer 1

1

That is not how to get input from request. For getting the input you should use

$data = $request->all();

That code will get all input request and store it to the array, after that you can get the ijazah input with:

$data['ijazah'];

Or if you only want to get 'ijazah' you can try this

$request->input('ijazah');
Sign up to request clarification or add additional context in comments.

1 Comment

@Affandi Yusuf, yeah its work, thanks for your advice my friend

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.