Today, We want to share with you how to get checkbox value in php if checked.In this post we will show you how to get checked and unchecked checkbox value in php, hear for The checkbox element in HTML allows us to select multiple items from the group of values. we will give you demo and example for implement.In this post, we will learn about Get multiple checkbox value using jquery PHP with an example.
Get checked Checkboxes value with PHP
1. Read $_POST checked values
Select players
PHP
JavaScript
jQuery
Angular JS
PHP
if(isset($_POST['submit'])){ if(!empty($_POST['player_name'])) { foreach($_POST['player_name'] as $value){ echo "value : ".$value.'
'; } } }
Completed Code
'; } } } ?>
3. Table structure
CREATE TABLE `players` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `player` varchar(80) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Configuration
config.php
Insert and Display checked values from Database
Completed Code
I hope you get an idea about if checkbox is checked value=1 else 0 in php.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.