Php 如果提交codeigniter,为什么禁用表单输入显示空值

Php 如果提交codeigniter,为什么禁用表单输入显示空值,php,forms,codeigniter,validation,codeigniter-3,Php,Forms,Codeigniter,Validation,Codeigniter 3,你好,我需要你的帮助 我的控制器上有这样的表单输入 //getting datas from database I need to make edit form $datas = $this->getvaluesitebyid($this->input->get('stid', TRUE)); $data['siteid'] = array( 'name' => 'siteid', 'type' => 'text',

你好,我需要你的帮助

我的控制器上有这样的表单输入

//getting datas from database I need to make edit form
$datas = $this->getvaluesitebyid($this->input->get('stid', TRUE));
$data['siteid'] = array(
            'name' => 'siteid',
            'type' => 'text',
            'class' => 'form-control',
            'placeholder' => 'Site ID',
            'value' => $datas['site_id_tlp'],
            'id' => 'disabledInput',
            'disabled' => '' //I set this form to be disabled
        );
在我看来,我打开了表格

<?php echo form_input($siteid); ?>

请帮帮我,谢谢

@alaamjaddou谢谢我忘记了
只读
属性我的表单输入现在做得很好,但是如果表单是下拉的怎么办?如果我使用
readonly
,我仍然可以编辑下拉列表。但是,我可以重新编辑我的问题或为表单下拉列表提出新问题?@jboxxpradhana否readonly不支持下拉列表我的朋友,我猜您将使用disabled,但使用下拉列表输入值向表单添加隐藏输入,或者您可以使用jquery返回下拉列表输入的假焦点,或者,您可以通过将这一行添加到下拉式指针事件中来实现css:无@alaamjaddou感谢您提供了大量可能的副本
Attribute definitions

disabled [CI] When set for a form control, this boolean attribute disables the control for user input. When set, the disabled attribute has the following effects on an element:

    Disabled controls do not receive focus.
    Disabled controls are skipped in tabbing navigation.
    Disabled controls cannot be successful.

The following elements support the disabled attribute: BUTTON, INPUT, OPTGROUP, OPTION, SELECT, and TEXTAREA.

This attribute is inherited but local declarations override the inherited value.

How disabled elements are rendered depends on the user agent. For example, some user agents "gray out" disabled menu items, button labels, etc.

In this example, the INPUT element is disabled. Therefore, it cannot receive user input nor will its value be submitted with the form.

<INPUT disabled name="fred" value="stone">

Note. The only way to modify dynamically the value of the disabled attribute is through a script.
Attribute definitions

disabled [CI] When set for a form control, this boolean attribute disables the control for user input. When set, the disabled attribute has the following effects on an element:

    Disabled controls do not receive focus.
    Disabled controls are skipped in tabbing navigation.
    Disabled controls cannot be successful.

The following elements support the disabled attribute: BUTTON, INPUT, OPTGROUP, OPTION, SELECT, and TEXTAREA.

This attribute is inherited but local declarations override the inherited value.

How disabled elements are rendered depends on the user agent. For example, some user agents "gray out" disabled menu items, button labels, etc.

In this example, the INPUT element is disabled. Therefore, it cannot receive user input nor will its value be submitted with the form.

<INPUT disabled name="fred" value="stone">

Note. The only way to modify dynamically the value of the disabled attribute is through a script.
//getting datas from database I need to make edit form
$datas = $this->getvaluesitebyid($this->input->get('stid', TRUE));
$data['siteid'] = array(
        'name' => 'siteid',
        'type' => 'text',
        'class' => 'form-control',
        'placeholder' => 'Site ID',
        'value' => $datas['site_id_tlp'],
        'id' => 'disabledInput',
        'readonly' => 'readonly' //I set this form to be disabled
    );