I have a form in php wich has some checkboxes named skills[]
, I want to know how to implode and post the correct way in this code, I was used to the usual msqli or normal post syntax, but now that I made country state city dropdown I can't figure out a way to correctly post it:
<?php
$skills = array('PHP', 'JavaScript', 'jQuery', 'AngularJS');
$commasaprated = implode(',' , $skills);
?>
<?php
//insert.php
if(isset($_POST['country']))
{
include('database_connection.php');
$query = "
INSERT INTO country_state_city_form_data (country, state, city, skills)
VALUES(:country, :state, :city, :skills)
";
$statement = $connect->prepare($query);
$statement->execute(
array(
':country' => $_POST['country'],
':state' => $_POST['state'],
':city' => $_POST['hidden_city'],
':skills' => $_POST['skills'],
)
);
$result = $statement->fetchAll();
if(isset($result))
{
echo 'done';
}
}
?>