2016-01-12 49 views
0

我有以下形式輸入:笨:form_input爲只讀

<?php echo form_input(array('name'=>'stockist['.$stockist->ID.'][ID]','value'=>form_decode($stockist->ID), 'class'=>'span1'));?> 

我想使這個只讀領域,但任何試圖把這個讀=僅使用HTML語法拋出一個錯誤。有誰知道是否有可能使form_input類型只讀?

感謝

回答

3
<?php echo form_input(array('name'=>'stockist['.$stockist->ID.'][ID]','value'=>form_decode($stockist->ID), 'class'=>'span1','readonly'=>'true'));?> 

這將做你的工作!祝你好運!

1

如下嘗試:

$data_name = array(
'name' => 'emp_name', 
'id' => 'emp_name_id', 
'value' => 'John' 
'readonly' => 'readonly' 
); 
echo form_input($data_name); 
1

添加'readonly' => 'readonly',使其只讀

<?php echo form_input(
     array('name' => "stockist['.$stockist->ID.'][ID]", 
    'value' => form_decode($stockist->ID), 
    'class' => 'span1', 
    'readonly' => 'readonly')); ?> 

CodeIgniter Form Helper