Integrate function input PHP in HTML input

1

Hi, I'm trying to integrate a PHP function into an HTML input, because if I remove the HTML input and leave only the PHP function, by not taking the styles the field is reduced in width by half, as you can see in the image. *

PHP + HTML

<div class="form-group">
    <label class="sr-only" for="form-username">Username</label> 
    <?php echo form_input($identity); ?>
    <!-- <input type="text" name="form-username" placeholder="Usuario..." class="form-username form-control" id="form-username">-->
</div>

    
asked by Jose 20.04.2017 в 09:19
source

2 answers

2

The problem is that the default codeigniter form_input () returns with style="50%" which means that your input is halved. but you can modify that in the array that you pass to the form_input () using the field "style", I'll give you an example.

$identity = array('nombre' => 'jhon', 'apellido' => 'doe', 'style' => 'width:100%;')

You also have the possibility to add css classes with the field 'class'.

    
answered by 20.04.2017 / 17:43
source
1

I assume that $identity is the html of your new field, please show us how you build it and add the css classes as you have them in your HTML input, this should be automatically seen as the inputs that you already handle.

    
answered by 20.04.2017 в 17:35