PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, March 8, 2022

[FIXED] Laravel Get Values from checkbox 0 turn null

 March 08, 2022     checkbox, laravel, sql     No comments   

Issue

I have database like this:

enter image description here

column cek for define checkbox with code like this:

<input type="checkbox" value="{{ ($d->kd == $d->cek ? '0' : '1')  }}" name="ada[]" @if($d->cek) checked @endif>

When its checked it will gave value '1', and when its unchecked its supposed to give value '0' but instead '0' i got null. Anyone here how should it? Thank you.


Solution

<input type="checkbox" value="{{ ($d->kd == $d->cek ? '0' : '1')  }}" 
name="ada[]" @if($d->kd == '1') checked @endif >


Answered By - simpson
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing