Using Codeigniter 3 I would like to display a glyphicon on my form submit button.
My code so far is;
$data = array(
'type' => 'submit',
'content' => 'Add Book',
'class' => 'btn btn-sm btn-labeled btn-success'
);
echo form_button($data);
This produces the following html;
<button type="submit" class="btn btn-sm btn-labeled btn-success">Add Book</button>
However I would like to produce this html;
<button type="submit" class="btn btn-sm btn-labeled btn-success"><span class="btn-label"><i class="glyphicon glyphicon-ok"></i></span> Add Book</button>
I have tried the following;
echo form_button('<span class="btn-label"><i class="glyphicon glyphicon-ok"></i></span>', $data);
This produces an error Array to string conversion.
I have also read the documentation, but can't figure it out.
Any help is appreciated.
You need to add the span like this
$data = array(
'type' => 'submit',
'content' => '<span class="btn-label"><i class="glyphicon glyphicon-ok"></i></span>Add Book',
'class' => 'btn btn-sm btn-labeled btn-success'
);
echo form_button($data);