开发者

Setting the 'name' property of a Form in Codeigniter

Referring to the Codeigniter user guide at http:开发者_StackOverflow中文版//codeigniter.com/user_guide/helpers/form_helper.html, I cannot seem to figure out how to set the 'name' property of a form using CI's form helper. Only 'id' can be set by passing an array in. Can the 'name' of the form be set without passing an array to the form_open() function?


you can use this method

$attributes = array('name' => 'myform');

echo form_open('email/send', $attributes);


The name attribute for a form is actually deprecated:

17.3 The FORM element

[....]

name = cdata [CI]
    This attribute names the element so that it may be referred to

from style sheets or scripts. Note. This attribute has been included for backwards compatibility. Applications should use the id attribute to identify elements.

Source: W3.org

If you really want to pass it, I fear you have no choice but using the array you want to avoid, as you read in the manual.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜