将数据从表单传递到php
尽管这是一个常见的话题,但经过一段时间的搜索,我还是没有找到答案 我的视图中有以下html:将数据从表单传递到php,php,html,arrays,checkbox,Php,Html,Arrays,Checkbox,尽管这是一个常见的话题,但经过一段时间的搜索,我还是没有找到答案 我的视图中有以下html: <div class="control-group"> <label class="control-label">Tipo de Socio</label> <div class="controls"> <label class="checkbox line"> <input type="checkb
<div class="control-group">
<label class="control-label">Tipo de Socio</label>
<div class="controls">
<label class="checkbox line">
<input type="checkbox" id="registered" value="registered" name="type[]" /> Registrado
</label>
<label class="checkbox line">
<input type="checkbox" value="notregistered" name="type[]"/> Pre-Registrado
</label>
</div>
</div>
我想要实现的是使用描述性名称命名子键,如:
array (size=2)
registered => string 'u.status = 2' (length=12)
notregistered => string 'u.status = 1' (length=12)
我应该直接从html中发送此子项名称,还是应该在php中创建一个函数来执行此操作?是的,您可以:
<div class="control-group">
<label class="control-label">Tipo de Socio</label>
<div class="controls">
<label class="checkbox line">
<input type="checkbox" id="registered" value="registered" name="type[registered]" /> Registrado
</label>
<label class="checkbox line">
<input type="checkbox" value="notregistered" name="type[notregistered]"/> Pre-Registrado
</label>
</div>
</div>
蒂波德社会
登记处
预注册
是的,我在问是否可以从html表单的内部数组中命名密钥
<div class="control-group">
<label class="control-label">Tipo de Socio</label>
<div class="controls">
<label class="checkbox line">
<input type="checkbox" id="registered" value="registered" name="type[registered]" /> Registrado
</label>
<label class="checkbox line">
<input type="checkbox" value="notregistered" name="type[notregistered]"/> Pre-Registrado
</label>
</div>
</div>