Search code examples
cakephp-3.0form-helpers

Add image to label (or alongside it) using FormHelper


I have an image that i want do display alongside with the label.

<?php
    echo $this->Form->input('ticketdays',['label'=>'Ticket days']);
?>
<img src="/img/help-round-button.png">

This is what happens now. I want do display it where the blue "circle" is.

enter image description here

How to achieve this? I accept any solution I can get. Already searched stackoverflow and Google and didn't find the answer.

Thanks.


Solution

  • Try something like this:

    <div>
        <label>Ticket days</label>
        <span style="top:50%" class="glyphicon glyphicon-info-sign"></span>
        <?php
            echo $this->Form->input('ticketdays', ['label' => false]);
        ?>
    </div>