CodeIgniter Forums

Full Version: Applying a style sheet class to a Form
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]MightyBishop[/eluser]
Hi all,

Still very new to all this, but loving it! Bit confused about applying style sheets to the form_open() command.

Say I want to end up with something like this in my page:

Code:
<form class="form-style">

How do I go about applying that class to the form_open() command?

I read somewhere else about adding on a style as an extra parameter to something, but for the life of me I can't remember - old age creeping in!

Thanks for any help,

Best regards

JB

El Forum

[eluser]TWP Marketing[/eluser]
From the User Guide:
http://ellislab.com/codeigniter/user-gui...elper.html

Quote:Adding Attributes

Attributes can be added by passing an associative array to the second parameter, like this:

Code:
$attributes = array('class' => 'email', 'id' => 'myform');

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

The above example would create a form similar to this:
Code:
<form method="post" accept-charset="utf-8" action="http:/example.com/index.php/email/send"  class="email"  id="myform" />

El Forum

[eluser]MightyBishop[/eluser]
Aha!

RTM comes to mind. Thank you very much for this.

Best regards

JB