how to get multiple checkbox value from database in php?

how to get multiple checkbox value from database in php? – Use the insert statement to insert the value into MySQL the database. To get multiple checkbox value from MySQL database use the select Query / statement. As all the available checkbox value is insert as a single comma separated value.

how to get multiple checkbox value from database in php?

get and display multiple checkbox values from database using php – How to retrieve one or multiple checkbox values from database using php and MySQL?

Table structure
[php]
CREATE TABLE `websites` (
`id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT,
`website` varchar(80) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
[/php]

Create a new config.php file.

[php]
index.php
[php]





Select websites
0){
$result = mysqli_fetch_assoc($fetchWeb);
$checked_arr = explode(“,”,$result[‘website’]);
}

$websites_arr = array(“infinityknow”,”pakainfo”,”itsolutionstuck”,”w3hub”);
foreach($websites_arr as $website){

$checked = “”;
if(in_array($website,$checked_arr)){
$checked = “checked”;
}
echo ‘ ‘.$website.’
‘;
}
?>




[/php]

Insert Multiple Checkbox Value in Database Using PHP

index.php
[php]

Select Website:
Infinityknow
Pakainfo
ItSolutionStuck
w3hub

alert(“Inserted Successfully”)‘;
}
else
{
echo’‘;
}
}
?>


[/php]

Leave a Comment