表单中复选框数据如何插入数据库?
我在表单里做了复选框,选中的复选框中的数据,保存在一个数组里,遍历数组,把每个元素拼起来,在保存在一个字符串里。如:
【选】篮球
【 】羽毛球
【 】乒乓球
【选】铅球
选中的:篮球 铅球 保存在$pre_u_have变量中
echo $pre_u_have;//可以显示:篮球 铅球
我要把表单插入数据库,复选框数据插入u_have字段
由于是复选框,u_have字段没办法和Form.u_have[]匹配
所以我插入了一个隐藏域
---------------1------------------------------
在里面,我把$pre_u_have直接赋给u_have,插入操作成功,但是数据库里该字段显示的是$pre_u_have(把这个变量名字当成字符串处理了)
----------------------2----------------------------
这样又显示:coloum "u_have" 不允许NULL,就是说数据插入数据库失败了。
-----------------------------------------------------
我现在的问题在哪里?我通宵,这个问题还是解决不了。
网上看到的都是:
$_POST['pre_u_have'];
这样的说法
关键是这一步要放在哪个位置?
------解决方案--------------------
print_r($_POST['tem']);
?>
------解决方案--------------------
------解决方案--------------------
也许这还真不是个问题。
------解决方案--------------------
放在PHP代码第1行,后面紧跟for循环,NO PUT IN HTML

laravel input隐藏域的实现方法:1、找到并打开Blade模板文件;2、在Blade模板中使用method_field方法来创建隐藏域,其创建语法是“{{ method_field('DELETE') }}”。

准备工作用vuecreateexample创建项目,参数大概如下:用原生input原生的input,主要是value和change,数据在change的时候需要同步。App.tsx如下:import{ref}from'vue';exportdefault{setup(){//username就是数据constusername=ref('张三');//输入框变化的时候,同步数据constonInput=;return()=>({

php提交表单通过后,弹出的对话框怎样在当前页弹出php提交表单通过后,弹出的对话框怎样在当前页弹出而不是在空白页弹出?想实现这样的效果:而不是空白页弹出:------解决方案--------------------如果你的验证用PHP在后端,那么就用Ajax;仅供参考:HTML code<form name="myform"

Vue.js是一种轻量级的JavaScript框架,具有易用、高效和灵活的特点,是目前广受欢迎的前端框架之一。在Vue.js中,input框绑定事件是一个十分常见的需求,本文将详细介绍Vue文档中的input框绑定事件。一、基础概念在Vue.js中,input框绑定事件指的是将输入框的值绑定到Vue实例的数据对象中,从而实现输入和响应的双向绑定。在Vue.j

点击input框没有光标的解决办法:1、确认输入框焦点;2、清除浏览器缓存;3、更新浏览器;4、使用JavaScript;5、检查硬件设备;6、检查输入框属性;7、调试JavaScript代码;8、检查页面其他元素;9、考虑浏览器兼容性。

Vue是一个流行的JavaScript前端框架,它的核心是响应式数据绑定和组件系统。在Vue的应用程序中,input框是最常用的UI元素之一。在用户输入文本时,我们希望可以监听回车事件,并且在提交前对输入内容进行验证。本篇文章将介绍Vue文档中的input框回车事件和验证函数使用方法。一、Vue中input框回车事件在Vue中监听input框的回车事件非常简

jquery中input是选择器选取表单元素,其作用是:1、input用于搜集用户信息,根据不同的type属性值,输入字段拥有很多种形式,输入字段可以是文本字段、复选框、掩码后的文本控件、单选按钮、按钮等等;2、input标签可定义输入域的开始,在其中用户可输入数据;3、使用input标签来进行定义,其中包括文本字段、多选列表、可单击的图像和提交按钮等。

html5 input禁止输入的实现方法:1、通过readonly规定输入字段为只读可复制;2、通过disabled实现被禁用的input元素可复制,但不能接收焦点;3、通过控制input的max length为0实现;4、通过“οnfοcus="this.blur();"”实现不能输入文本即可。


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),
