I have a strange issue with the codeigniter
form_open
function.
When I pass this code:
<?php echo form_open('login/check');?>
It actually prints out this
<form action="http://***.***.***.***/***/index.php/login" method="post" accept-charset="<meta charset="utf-8">">
The error is exactly at the end of the form open tag. Where is located the accept-charset
attribute. Besides the fact that I do not need the accept-charset
attribute, since I've declared the meta in the head, it's printing it in a wrong format!
accept-charset="<meta charset="utf-8">">
This code outputs on the page the form and the double quotes and the angular closing.
">
The real problem it's not the accept-charset
attribute itself but the wrong printing of it. Instead of accept-charset="utf-8"
it pulls in the meta tag of the charset.
What's happening?
Please check the documentation of Codeigniter http://www.codeigniter.com/user_guide/helpers/form_helper.html . It says that if you are using form_open()
then it creates an opening form tag with a base URL built from your config preferences. It will optionally let you add form attributes and hidden input fields, and will always add the attribute accept-charset based on the charset value in your config file.
Also try this it should works as it will not override if already defined in the attributes.
$attributes = array(
'accept-charset'=>'utf8'
);
echo form_open('login/check', $attributes);