Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

adding a class to form_submit in PHP Codeigniter

I'm trying to add a class to form_submit in PHP Codeigniter; Im doing with the following code:

        $attributes1=array(
            'class'=>'btn btn-danger',
        );
        echo form_submit('loginSubmit', 'Login',$attributes1['class']);

But the rendered code in HTML is as following:

<input type="submit" name="loginSubmit" value="Login" btn="" btn-danger="">

could you please let me know who I can the class to my form_submit?

Also If it is not clear please let me know which part is ambiguous so I will provide more clarification

Many thanks

like image 325
user385729 Avatar asked Oct 08 '13 00:10

user385729


2 Answers

Use Like this

echo form_submit('loginSubmit', 'Login',"class='btn btn-danger'");
like image 193
Ts8060 Avatar answered Nov 07 '22 02:11

Ts8060


I use it like this:

echo form_submit(array(
        'id' => 'submit', 
        'value' => 'Enter', 
        'class' => 'btn btn-primary'
     ));
like image 39
fips123 Avatar answered Nov 07 '22 00:11

fips123