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>
Jr. Sr. Baby Diaper Pants | Medium (M) Size (7-12 kg), 72 Count | Pack of 1 | Upto 12 hr Absorption with Advanced Leak Protection | Safe For Babies Skin | Soft, Secure & Comfy
₹479.00 (as of January 7, 2026 22:17 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's Soft Cleansing Baby Wipes with Lid | 80 Wipes x Pack of 3 - 240 Wipes | Extra Thick & Moist Wet Wipes for Baby's | Prevents Rashes & Redness with Goodness of Aloe Vera, Vitamin E & Jojoba Oil
₹215.00 (as of January 7, 2026 22:17 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.)Cetaphil Baby Daily Lotion, Suitable for baby’s delicate skin, Shea Butter and Vit E, Dermatologist Tested and Pediatrician Recommended, 400 ml
₹798.00 (as of January 7, 2026 22:17 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.)Zest 4 Toyz Baby Play Mat for Babies Play Gym Floor Mat for Kids with Hanging Rattles Lights & Musical Keyboard Kick and Play Bed Piano for New Born Baby Gifts - (Made in India)
Now retrieving the price.
(as of January 7, 2026 22:17 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.)Huggies Natural Soft Premium Baby Diaper Pants, Our No.1 Soft Pants, Medium (M) Size (7-12 Kgs), Pack of 60 diapers | Cloud Softness All over with India's 1st Cloud Touch BeltTM
₹794.00 (as of January 7, 2026 22:17 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.)Baby Sleeping Support Pillow with Side Rollers | Newborn Safety Sleeping Pillow Set | Soft Cotton Infant Neck Pillow for 0–12 Months | Anti-Flat Head Cushion for Baby Boys & Girls (Light Blue)
₹277.00 (as of January 7, 2026 22:17 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.).allter Breeze Baby Diaper Pants - L Size (9-14 Kgs) | 60 Count, Pack of 2 | AirFit™ Technology for Breathable Comfort | Dermat Tested | 12-Hour Dryness, Super Soft & Absorbent with Wetness Indicator
₹1,299.00 (as of January 7, 2026 22:17 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.)Decazone Macrame Toy Hammock Organizer for Stuffed Animals | Handmade Cotton Rope Storage Net | Boho Wall Hanging Nursery Organizer | Corner Mesh Hammock for Kids Room & Home Decor
₹299.00 (as of January 7, 2026 22:17 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.)Baby Sleeping Support Pillow with Side Rollers | Newborn Safety Sleeping Pillow Set | Soft Cotton Infant Neck Pillow for 0–12 Months | Anti-Flat Head Cushion for Baby Boys & Girls (LightBlue)
₹287.00 (as of January 7, 2026 22:17 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.)TEDDYY Baby Easy Pant Diapers Medium 74 Count (Pack of 1), 7-12 kgs, 10 hrs Leak Protection, Anti - Bacterial
₹474.00 (as of January 7, 2026 22:17 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.)Seagate Expansion 1TB External HDD - USB 3.0 for Windows and Mac with 3 yr Data Recovery Services, Portable Hard Drive (STKM1000400)
Now retrieving the price.
(as of January 8, 2026 05:20 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!