爆破数组如何使其正确?
我在php中有一个表格,有一些名为技能[]
的复选框,我想知道如何在此代码中以正确的方式爆炸和发布正确的方式,我已经习惯了通常的msqli或普通帖子语法,但是,现在我将乡村国家城市下拉列出来,我无法找到一种正确发布它的方法:
<?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';
}
}
?>
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';
}
}
?>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在内部您
if(ISSET($ _ post ['country'])))
incode> include() do:
Inside you're
if(isset($_POST['country']))
After you're
include()
do: