"Array to string conversion" error while passing an array as the second parameter of CodeIgniter's form_label() helper function
A PHP Error was encountered
Severity: Notice
Message: Array to string conversion
Filename: helpers/form_helper.php
Line Number: 522
Here is my view that contains form
'login'));
// first input field
echo "";
echo form_label('Username', array('for' => 'login_username'));
echo form_input(array(
'type' => 'text',
'name' => 'username',
'id' => 'login_username',
'value' => set_value('username')
));
echo "";
// second input field
echo "";
echo form_label('Password', array('for' => 'login_password'));
echo form_password(array('type' => 'password', 'name' => 'password', 'id' => 'login_password'));
echo "";
// submit button
echo "";
echo form_button(array('type' => 'submit', 'content' => 'Log in'));
echo "";
echo "";
// display if incorrect username/password
if ($this->session->flashdata('login_error'))
echo 'Incorrect username/password';
// display if incorrect input data
echo validation_errors();
echo "";
// close the form
echo form_close();
?>
Here is form_helper.php (line 513 to 537) that is mentioned in PHP Error
if ( ! function_exists('form_label'))
{
function form_label($label_text = '', $id = '', $attributes = array())
{
$label = '";
return $label;
}
}