Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/264.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 验证文本区域_Php_Jquery_Codeigniter - Fatal编程技术网

Php 验证文本区域

Php 验证文本区域,php,jquery,codeigniter,Php,Jquery,Codeigniter,除了我的文本区域之外,所有其他表单元素都有效。思考一下为什么使用下面的代码 <?php $attributes = array('cols' => '30', 'rows' => '5', 'id' => 'article', 'class' => 'required') ?> <div> <?php echo form_textarea('article', '', $attributes); ?> </div

除了我的文本区域之外,所有其他表单元素都有效。思考一下为什么使用下面的代码

<?php $attributes = array('cols' => '30', 'rows' => '5', 'id' => 'article', 'class' => 'required') ?>
 <div>
     <?php echo form_textarea('article', '', $attributes); ?>  
 </div>

编辑: 我正在使用jQuery验证类

<div class="section _100">
<label for="article">Article</label>   
    <div>
        <textarea name="article" cols="40" rows="10" Array></textarea>  
    </div>
</div>

文章

所以现在我想知道为什么它在完成类部分的属性放置时会显示这样的数组。

当您传递属性数组时,它应该是唯一的
表单文本区域
函数。尝试以下操作:

<?php $attributes = array('name' => 'article', 'cols' => '30', 'rows' => '5', 'id' => 'article', 'class' => 'required') ?>
<div>
    <?php echo form_textarea($attributes); ?>  
</div>

当您传递属性数组时,它应该是唯一的
form\u textarea
函数。请尝试以下操作:

<?php $attributes = array('name' => 'article', 'cols' => '30', 'rows' => '5', 'id' => 'article', 'class' => 'required') ?>
<div>
    <?php echo form_textarea($attributes); ?>  
</div>

根据,您可以通过将名称和属性值作为两个参数传递或将所有属性作为数组作为单个参数传递来生成
文本区域

请注意,在您的代码中有第三个参数。它是为其他数据保留的,如JavaScript。它只是作为字符串附加在
textarea
标记中-这就是您看到
Array
的原因

像这样创建您的
文本区域
,但在
$attributes
数组中包含您的姓名:

$attributes = array(
    'name' => 'article', 
    'cols' => '30',
    'rows' => '5', 
    'id' => 'article', 
    'class' => 'required'
);

echo form_textarea($attributes); 
根据,您可以通过将名称和属性值作为两个参数传递或将所有属性作为数组作为单个参数传递来生成
textarea

请注意,在您的代码中有第三个参数。它是为其他数据保留的,如JavaScript。它只是作为字符串附加在
textarea
标记中-这就是您看到
Array
的原因

像这样创建您的
文本区域
,但在
$attributes
数组中包含您的姓名:

$attributes = array(
    'name' => 'article', 
    'cols' => '30',
    'rows' => '5', 
    'id' => 'article', 
    'class' => 'required'
);

echo form_textarea($attributes); 

请发布您的验证规则和逻辑。对不起,这是为了jqueryThen发布您的实际HTML以及您正在使用的任何jQuery验证逻辑。无法说出您发布的代码有什么问题。请发布您的验证规则和逻辑。对不起,这是为了jqueryThen发布您的实际HTML以及任何jQuery valida你正在使用的逻辑。不可能说出你发布的代码有什么问题。