Nyxynyx
Nyxynyx

Reputation: 63657

Setting the 'name' property of a Form in Codeigniter

Referring to the Codeigniter user guide at http://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?

Upvotes: 3

Views: 8796

Answers (2)

chhameed
chhameed

Reputation: 4456

you can use this method

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

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

Upvotes: 7

Damien Pirsy
Damien Pirsy

Reputation: 25435

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.

Upvotes: 3

Related Questions