- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我试图在代码点火器中的注册表单上填充下拉框,但我没有运气,下面是来 self 的 Controller 、模型和 View 的片段。 Base 是下拉字段。
型号
function get_airports()
{
$this->db->select('airport_code, airport_name');
$this->db->order_by('airport_code', "asc");
$query = $this->db->get('airports');
if($query){
$query = $query->result_array();
return $query;
}
}
}return $data
}
function create_member()
{
$new_member_insert_data = array('first_name' => $this->input->post('first_name'),
'last_name' => $this->input->post('last_name'),
'email_address'=> $this->input->post('email_address'),
'username'=> $this->input->post('username'),
'password'=> md5($this->input->post('password')),
'birthdate'=> $this->input->post('birthdate'),
'base'=> $this->input->post('base')
);
$insert = $this->db->insert('membership', $new_member_insert_data);
return $insert;
}
} ?>
查看
$airports = $this->get_airports(true,'Please Select');
$selected = set_my_defaults('airport',$default);
echo form_dropdown('base', set_value('base', $airports, $selected, 'class="dropdown_style"'));
查看 2 个基地我将其作为单独的 View 并将其包含在主注册表中
<select>
<?php
foreach($myDropdown as $dd)
echo "<option value='". $dd['your_field'] ."'>". $dd['your_field'] ."</option>";
?>
</select>
Controller
function getairport(){
$query = $this->membership_model->get_airports();
if($query)
{
$data['main_content'] = 'base';
$this->load->view('base', $data);
}
}
function create_member()
{
$this->load->library('form_validation');
//fieldname, error messaage, validation rules
$this->form_validation->set_rules('first_name', 'Name', 'trim|required');
$this->form_validation->set_rules('last_name', 'Last Name', 'trim|required');
$this->form_validation->set_rules('email_address', 'Email', 'trim|required|valid_email');
$this->form_validation->set_rules('username', 'Username', 'trim|required|min_length[4]');
$this->form_validation->set_rules('password', 'Password', 'trim|required|min_length[4]|max_length[32]');
$this->form_validation->set_rules('password2', 'Password Confirmation', 'trim|required|matches[password]');
$this->form_validation->set_rules('birthdate', 'Birthdate', 'trim|required|');
$this->form_validation->set_rules('base', 'Base', 'trim|required');
if($this->form_validation->run()== FALSE)
{
最佳答案
你的格式应该是这样的:
$options = array(
'small' => 'Small Shirt',
'med' => 'Medium Shirt',
'large' => 'Large Shirt',
'xlarge' => 'Extra Large Shirt',
);
$shirts_on_sale = array('small', 'large');
echo form_dropdown('shirts', $options, 'large');
这会产生:
<select name="shirts">
<option value="small">Small Shirt</option>
<option value="med">Medium Shirt</option>
<option value="large" selected="selected">Large Shirt</option>
<option value="xlarge">Extra Large Shirt</option>
</select>
引用 HERE
<小时/> 更新如果您愿意,也可以尝试一下
型号
$this->db->select('airport_code, airport_name');
$this->db->order_by('airport_code', "asc");
$query = $this->db->get('airports');
if($query)
{
$query = $query->result_array();
return $query;
}
Controller
$query = $this->your_model->your_method();
if($query)
{
$data['myDropdown'] = $query;
$this->load->view('your_view', $data);
}
查看 - 您的下拉问题
<select>
<?php
foreach($myDropdown as $dd)
echo "<option value='". $dd['your_field'] ."'>". $dd['your_field'] ."</option>";
?>
</select>
关于php - 尝试用 mysql 数据填充 codeigniter 中的下拉菜单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16977417/
冷静下来,不吹不黑。 01 最近半年,互联网一款现象级的应用诞生:「ChatGPT」; 其火爆的程度,不输前面的羊了个羊; 最初了解到ChatGP
在了解在 .Net 中开发是什么样子之前,我有几个新手问题: 非管理员用户能否安装 .Net 框架,无论是原始包还是运行程序所需的任何后续更新?我们的一些客户锁定了 XP/Vista 主机,当我们上传
https://plus.google.com/u/1/110412141990454266397/posts/Nvr6Se6eAPh 有谁知道如何使用最新版本的 GWT(来自 svn)和 Chrom
已关闭。此问题不符合Stack Overflow guidelines 。目前不接受答案。 要求我们推荐或查找书籍、工具、软件库、教程或其他场外资源的问题对于 Stack Overflow 来说是偏离
我需要在加载 NSDocument 之前创建多个窗口,或者创建一个阻止 NSDocument 窗口和顶部菜单的窗口。 我尝试了几种解决方案 - 但它们都不起作用。 模态窗口,一个接一个。 Async
尝试配置 spring 3 MVC,这是我目前所做的: 我将所有 spring 3.0 库添加到我的 netbeans 项目中。 我的 web.xml 是: WebApp
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be
我无法让 Resharper 的清理代码停止更改如下属性: public long Value { get { return _thingy; } se
我并不是真的在寻找基本的 SQL 指南,而是寻找特定于 PostgreSQL 的东西。 而且我确实运行自己的服务器,因此获取最新版本(我相信是 8.2?)没问题。 最佳答案 重要的事情: 如果可以(既
这是 Adobe Encore 程序的屏幕截图。 在这里,您可以看到一组深色组件。 可以购买,下载等吗?它们是从 Adobe Cor. 公开的吗? 谢谢 最佳答案 实现这种外观和感觉的最简单方
我有一个代码(可以正常工作)用于使用 C++ Builder 来引导 word。它对于访问文档中的不同书签很有用。 Variant vNom, vWDocuments, vWDocument, vMS
我是一名优秀的程序员,十分优秀!