Hi Geeks
Today we are going to see how to retrieve selected and unselected checkbox from the mysql database using php
<?php
include "config.php";
?>
<!doctype html>
<html>
<head>
<?php
if(isset($_POST['submit'])){
if(!empty($_POST['lang'])) {
$lang = implode(",",$_POST['lang']);
// Insert and Update record
$checkEntries = mysqli_query($con,"SELECT * FROM languages");
if(mysqli_num_rows($checkEntries) == 0){
mysqli_query($con,"INSERT INTO languages(language) VALUES('".$lang."')");
}else{
mysqli_query($con,"UPDATE languages SET language='".$lang."' ");
}
}
}
?>
</head>
<body>
<form method="post" action="">
<span>Select languages</span><br/>
<?php
$checked_arr = array();
// Fetch checked values
$fetchLang = mysqli_query($con,"SELECT * FROM languages");
if(mysqli_num_rows($fetchLang) > 0){
$result = mysqli_fetch_assoc($fetchLang);
$checked_arr = explode(",",$result['language']);
}
// Create checkboxes
$languages_arr = array("PHP","JavaScript","JAVA","HTML");
foreach($languages_arr as $language){
$checked = "";
if(in_array($language,$checked_arr)){
$checked = "checked";
}
echo '<input type="checkbox" name="lang[]" value="'.$language.'" '.$checked.' > '.$language.' <br/>';
}
?>
<input type="submit" value="Submit" name="submit">
</form>
</body>
</html>
Mee Mee Wet Wipes for Baby Skin with Aloe Vera 72Pcs, Pack of 3 | Paraben Free, Fragrance Free, pH Balanced, Dermatologically Safe, Baby Wipes Combo | Pack With Lid
₹198.00 (as of November 30, 2025 16:49 GMT +05:30 - More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)Mother Sparsh Milky Soft Head to Toe Baby Wash & Baby Shampoo-400ml with Milk Protein & Shea Butter |Ph balanced & Paraben free 2 in 1 Natural Baby Body Wash
₹265.00 (as of November 30, 2025 16:49 GMT +05:30 - More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)Little Boo Microfiber Coral Fleece Baby Face Towels, Soft and Absorbent Wash Clothes for Newborns, Infants and Toddlers, Cotton Wipes & Burp Cloths Size 25x25cm Multicolor (Pack of 5)
₹149.00 (as of November 30, 2025 16:49 GMT +05:30 - More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)Himalaya Baby Shampoo (400 ml)
₹226.00 (as of November 30, 2025 16:49 GMT +05:30 - More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)LuvLap Pant Style Baby Diapers, Large (L), 62 Count, For babies of Upto 9-14Kg with Aloe Vera Lotion for rash protection, with upto 12hr protection, Diapers
₹532.00 (as of November 30, 2025 16:49 GMT +05:30 - More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)Mother Desire Baby Wet Wipes With 99% Pure Water, Aloevera, Vit E & Chamomile | Rash Free, pH Balanced, Alcohol & Paraben Free Soft Cleansing Wet Tissue With Lid | 72 Wipes Each, Pack Of 3
₹169.00 (as of November 30, 2025 16:49 GMT +05:30 - More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)HANUSH 100% Muslin Cotton Baby Towel – Double Layer Soft Newborn Bath Wrap, Organic Muslin Bath Towel for Infants & Babies (Bath Towel)
₹459.00 (as of November 30, 2025 16:49 GMT +05:30 - More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)Amazon Brand - Supples Premium Baby Diaper Pants | 72 Baby Diapers | Medium | 7-12 Kg | 12 Hrs Absorption | Cushiony Cotton Soft Fabric | Phthalates-Free | Triple Leak Guard
₹519.00 (as of November 30, 2025 16:49 GMT +05:30 - More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)Jr. Sr. Baby Tape Style Diaper | Adjustable Fit For Babies | Newborn/Extra Small (NB/XS) Size (0-5kg), 72 Count | Pack of 1 | Upto 12 hr Absorption with Advanced Leak Protection | Soft & Comfy
Now retrieving the price.
(as of November 30, 2025 16:49 GMT +05:30 - More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)
Greetings! This is my first visit to your blog! We are a team
of volunteers and starting a new initiative in a community in the same niche.
Your blog provided us valuable information to work on. You have done a extraordinary job!
Greetings from Colorado! I’m bored at work so I decided to
browse your blog on my iphone during lunch break.
I really like the information you present here and can’t wait to take a
look when I get home. I’m amazed at how fast your blog loaded on my mobile ..
I’m not even using WIFI, just 3G .. Anyhow, very good site!
I relish, lead to I discovered exactly what I was looking for.
You’ve ended my four day long hunt! God Bless you man. Have a great day.
Bye
Hey there! I’ve been following your web site for a while now and finally got the bravery to go ahead and
give you a shout out from Porter Texas! Just wanted to say keep up the fantastic work!