Checkboxes are a versatile tool found on many websites, allowing users to select their preferred choices among different options available with ease.
When you use it in your form and try to read all checked values as any other elements like – text box, text area, radio button, etc.
echo $_POST['lang']; // Checkbox element
you will get the last checked value.
You need to send the checkboxes value in the form of an Array when the form gets submitted then you can loop over $_POST values.
In this tutorial, I show how you can read submitted checked checkboxes values with PHP and also show how you can save it to the MySQL database.