I am working on an application that requires authentication, in Codeigniter 3. Rather then making my own authentication, I decided to use the Ion-Auth library.
Because I also use Bootstrap 4, I tried to add form-related classes to the form controls. I tried to replace:
<p>
<label for="new_password"><?php echo sprintf(lang('change_password_new_password_label'), $min_password_length);?></label> <br />
<?php echo form_input($new_password);?>
</p>
with:
<div class="form-group">
<?php $attributes = array(
'class' => 'form-control',
'placeholder' => 'New password',
'value' => $new_password
); ?>
<label for="new_password"><?php echo sprintf(lang('change_password_new_password_label'), $min_password_length);?></label> <br />
<?php echo form_input($attributes);?>
</div>
The code above throws the error message Array to string conversion.
What am I doing wrong?
You haven't specified what function you're calling but after looking
Ion-Auth library, I'm guessing it'sreset_password(). Regardless,In your
controller, the data is passed as -Now
$new_passwordis an array inview. So, in order to give it value and pass extra attributes, you'll have to write -This will produce -
Edit
For
form_submit, you can write -or as an array -
This will produce -
See if this helps you.