Encoding problem |
[eluser]Project Team[/eluser]
Hello guys, i have made this custom php code, which convert some input fields in a specific encoding. Here is my code: Code: echo "<form enctype=\"multipart/form-data\" method=\"post\" action=\"index.php?ok=1\" target=\"_top\">"; How can i make the same in codeigniter?? I have tried to add the iconv in my model where i insert the form fields but it inputs null in this specific cell of the database. I try something like this but nothing: Code: function insert_new() { Any ideas?? Any help or ideas would be appreciated! Thank you!!
[eluser]DarkManX[/eluser]
Try to output your received vars (id and name) before insert then into db, they maybe empty. Some tips to improve your coding style: Dont use quotation marks for strings, because php parses these string for vars. that slows your code down - another sideeffect for you - you dont have to backslash all the quotation marks. If you have bunch of html-code without any php-vars inside just ?> and <?php after html. Dont use multipart/form-data for your forms if you are not sending any files. Use empty() to check weather your vars are empty. You should get used to the common convention of the MySQL (INSERT INTO customers VALUES...) Dont declare vars you dont need - like: Code: $data = array('name'=>'test'); Code: $this->db->insert('table',array('name'=>'test'));
[eluser]Project Team[/eluser]
Thanks for your tips! The vars id and name are shown without any problem if i try to print them. Eg. if i write Code: function insert_new() { Is there any function in codeigniter to achieve this?? Thanks again!
[eluser]DarkManX[/eluser]
Well, maybe the stuff gets striped due to security reasons. Generally you dont want to store converted values in your database. Just put it like they are and convert them when you put them out.
[eluser]Project Team[/eluser]
Hi! I have found a sollution of what i wanted. http://louposk.wordpress.com/2012/08/22/...deigniter/ Hope to help someone else! |
Welcome Guest, Not a member yet? Register Sign In |