کد PHP:
$category_id=$_POST['category_id'];
foreach($category_id as $cat){
}
if($a==1 && $b==1 && $c==1 && $d==1 && $e==1 && !empty($time) && !empty($date) && !empty($level)){
$record=$connect->prepare("INSERT INTO `db_post` (`title`,`text`,`description`,`keywords`,`time`,`date`,`author_id`,`category_id`) VALUES (?,?,?,?,?,?,?,?)");
$record->bindValue(1,$post['title']);
$record->bindValue(2,$post['text']);
$record->bindValue(3,$post['description']);
$record->bindValue(4,$post['keywords']);
$record->bindValue(5,$time);
$record->bindValue(6,$date);
$record->bindValue(7,$level);
$record->bindValue(8,$cat);
if($record->execute()){
$success='پست شما با موفقیت در وبسایت ثبت شده است .';
}
else{
header('location: post.php');
die;
}
}