我正在尝试发布一个具有不同字段名称的嵌套单选按钮,我尽我所能,但我还没有成功。
<form id="w0" class="form-vertical" action="" method="post">
<input type="hidden" name="_csrf" value="">
<label>Choose If you are human</label>
<div class="radio">
<label>
<input type="radio" name="name1" value="1">
<h4> Gender:
<input type="radio" name="male" value="m">Male
<input type="radio" name="gender" value="f">Female
</h4>
</label>
</div>
<hr>
</div>
<div class="help-block"></div>
</div><br>
<div class="form-group">
<button type="submit" class="btn btn success">Submit</button>
</div>
</form>
<?php
if(isset($_POST['name1']) && isset($_POST['gender'])){
$model->name = $_POST['name1'];
$model->gender= $_POST['gender'];
$model->save();
}