Codeigniter:使用表单助手输入类型编号

时间:2017-10-03 00:40:29

标签: php codeigniter

我正在尝试使用表单助手将输入类型设置为数字。

以下是我试过的代码,但它对我不起作用,请帮帮我。

<?php

 $numberfield = array( 'type' => 'number', 'class' => 'form-control qty ' );
 echo form_input('cart[' . $item['id'] . '][qty]', $item['qty'], 'maxlength="3" size="1" style="text-align: right"',$numberfield); ?>

1 个答案:

答案 0 :(得分:0)

嗯,你的语法错了。你给它4个参数,虽然它只接受最多3个。那些也没有意义。使用数组或字符串,但不能同时使用两者。根据PHP规则,它将忽略第4个参数(指定输入类型的参数)

You can read the documentation here, it should make it clear, how to correctly use form_input.

相关问题