使用php和mysql将多个复选框值存储到数据库 [英] store multiple checkbox values to database using php and mysql

查看:466
本文介绍了使用php和mysql将多个复选框值存储到数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想存储多个复选框值以存储在单个字段中。我使用该链接 http://www.mindfiresolutions .com / Storing-array-data-to-MySQL-using-PHP-1296.php 。但是我没有得到结果.Give帮助找到这个问题。

I want to store the multiple checkbox values to store in a single field. I use that link http://www.mindfiresolutions.com/Storing-array-data-to-MySQL-using-PHP-1296.php. But i dont get the result.Give Help to find that problem.

推荐答案

将列设置为'set'可能的值。)数据类型,然后运行以下查询。

Set your column as 'set' (specify the all possible values.) data type and than run the below query.

$comma_separated = implode(",", $values);
$insert_query = "INSERT INTO TABLE_NAME(col_name) VALUES('$comma_separated')";
$result_insert = mysql_query($insert_query);

我希望这可以解决您的问题。

I hope this will solve your problem.

这篇关于使用php和mysql将多个复选框值存储到数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆