How to insert multiple checkbox values in the database in PHP
We can insert multiple checkbox values in a single column in the database in PHP with the help of an implode function in the form of an array.
Also read, How to insert HTML form data into MySQL Database using PHP
How to insert checkbox array value in the database in PHP
you can create a table in your existing database. Here, I am using a table named ‘cars’ that consists of four fields: — id,company_name, brand_name, and car_name.
DDL information of the table
— — — — — — — — — — — — — — — — — —
CREATE TABLE `cars` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT, `company_name` varchar(225) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `brand_name` varchar(225) COLLATE utf8mb4_unicode_ci DEFAULT NULL,`car_name` varchar(225) COLLATE utf8mb4_unicode_ci DEFAULT NULL,PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4
COLLATE=utf8mb4_unicode_ci