Home >Backend Development >PHP Tutorial >TP obtains form fields of type name=data[] (code)
The content of this article is about TP obtaining the form field content (code) of the name=data[] type. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you. .
Recently during development work, I came across a new method of obtaining submitted form fields, which is to use php or Thinkphp to obtain the form field content of the name=data[] type! Let’s take a look below!
1.HTML file
<form method="post" action="www.yimudi.cc/yimudi"> <input type="hidden" value="{$info.ymd_id}" name="data[ymd_id]" /> <input type="hidden" value="{$info.ymd_name}" name="data[ymd_name]" /> <input type="hidden" value="{$info.ymd_sex}" name="data[ymd_sex]" /> <div class="row cl"> <label class="form-label col-2"><span class="c-red">*</span>一亩地名称:</label> <div class="formControls col-10"> <input type="text" class="input-text" value="{$info.ymd_info}" placeholder="一亩地信息" name="data[ymd_info]"> </div> </div> </form>
2.Get the form content of name=data[] type
<?php //获取表单字段为name=data[]类型的数据 public function yimudiSave(){ $data=I('data'); dump($data);die; }
The above is How to get the content of form fields of type name=data[] in php or Thinkphp! Everyone can try it out during development!
Related recommendations:
How to use native MySQL statements in TP (code)
Thinkphp upload class implements code for uploading images
The above is the detailed content of TP obtains form fields of type name=data[] (code). For more information, please follow other related articles on the PHP Chinese website!