twitter-bootstrap 在 PHP Codeigniter 中向 form_submit 添加一个类

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19236867/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 18:47:33  来源:igfitidea点击:

adding a class to form_submit in PHP Codeigniter

phpcodeignitertwitter-bootstrap

提问by user385729

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

我正在尝试在 PHP Codeigniter 中向 form_submit 添加一个类;我使用以下代码:

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

But the rendered code in HTML is as following:

但在 HTML 中呈现的代码如下:

<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?

你能告诉我谁能给我的 form_submit 上课吗?

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

另外,如果不清楚,请让我知道哪个部分不明确,以便我提供更多说明

Many thanks

非常感谢

回答by Ts8060

Use Like this

像这样使用

echo form_submit('loginSubmit', 'Login',"class='btn btn-danger'");

回答by fips123

I use it like this:

我像这样使用它:

echo form_submit(array(
        'id' => 'submit', 
        'value' => 'Enter', 
        'class' => 'btn btn-primary'
     ));