[英]Retrieve stored radio button value from database
我在EditDevice视图文件中有一个下拉列表,该列表已经从数据库中加载了值。
<select name="TrackerType" name="Type" id="Type" style="width:68% !important;">
<option <?php echo ($devicearray['type']=='mobile'?'selected="selected"':''); ?>>mobile</option>
<option <?php echo ($devicearray['type']=='third party'?'selected="selected"':''); ?>>third party</option>
<option <?php echo ($devicearray['type']=='other'?'selected="selected"':''); ?>>other</option>
现在,我想在控制器文件中检索选定的值。
$NewDeviceArray["Type"] = $this->input->post("Type");
但是在打印“类型”时没有得到所选的值。
var_dump($NewDeviceArray["Type"]);
因此,我的问题是如何从下拉列表中的控制器中获取选定的值。
尝试这个
<select name="Type" id="Type" style="width:68% !important;">
<option value="mobile" <?php echo ($devicearray['type']=='mobile'?'selected="selected"':''); ?>>mobile</option>
<option value="third party" <?php echo ($devicearray['type']=='third party'?'selected="selected"':''); ?>>third party</option>
<option value="other" <?php echo ($devicearray['type']=='other'?'selected="selected"':''); ?>">other</option>
</select>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.