CodeIgniter Forums
accented with $this->input->post - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: accented with $this->input->post (/showthread.php?tid=31117)

Pages: 1 2


accented with $this->input->post - El Forum - 06-07-2010

[eluser]cmarra[/eluser]
Hello everyone, I have a small problem with $this->input->post('title');

Basically I cut blah accented letters typed by the user ...

I try to explain better:

$Title = $this->input->post('title');

I would need to clean the string received from the form ...
I tried to replace accented letters with those with normal str_replace but seems to work ...

How do I replace for example a, and with it etc etc?

Thanks


accented with $this->input->post - El Forum - 06-07-2010

[eluser]Clooner[/eluser]
[quote author="cmarra" date="1275934214"]Hello everyone, I have a small problem with $this->input->post('title');

Basically I cut blah accented letters typed by the user ...

I try to explain better:

$Title = $this->input->post('title');

I would need to clean the string received from the form ...
I tried to replace accented letters with those with normal str_replace but seems to work ...

How do I replace for example a, and with it etc etc?

Thanks[/quote]

from our friend google
Code:
function removeaccents($string)
{
  return strtr($string,
"ŠŒŽšœžŸ¥µÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝß
àáâãäåæçèéêëìíîïðñòóôõöøùúûüýÿ",
"SOZsozYYuAAAAAAACEEEEIIIIDNOOOOOOUUUUYsaaaaaaaceeeeiiiionoooooouuuuyy");
}



accented with $this->input->post - El Forum - 06-07-2010

[eluser]Clooner[/eluser]
http://www.php.net/manual/en/function.strtr.php has some more on this


accented with $this->input->post - El Forum - 06-07-2010

[eluser]cmarra[/eluser]
ehm thank you but I already tried this function and still does not work ...
ie if the function I pass the word so removeaccents (will) WORKS!
but if I do so:

$ Title = $ this-> input-> post ('title');

removeaccents ("$ title") THAT DOES NOT WORK!

I think the problem is just $ this-> input-> post ('title'); ....


accented with $this->input->post - El Forum - 06-07-2010

[eluser]Clooner[/eluser]
[quote author="cmarra" date="1275936412"]ehm thank you but I already tried this function and still does not work ...
ie if the function I pass the word so removeaccents (will) WORKS!
but if I do so:

$ Title = $ this-> input-> post ('title');

removeaccents ("$ title") THAT DOES NOT WORK!

I think the problem is just $ this-> input-> post ('title'); ....[/quote]


try
Code:
$title = removeaccents($title);



accented with $this->input->post - El Forum - 06-07-2010

[eluser]Clooner[/eluser]
btw what does your profiler say on the post data?
http://ellislab.com/codeigniter/user-guide/general/profiling.html


accented with $this->input->post - El Forum - 06-07-2010

[eluser]cmarra[/eluser]
now I'm working, just added aa house feel but what is the class Profiler?


accented with $this->input->post - El Forum - 06-07-2010

[eluser]Clooner[/eluser]
[quote author="cmarra" date="1275936933"]now I'm working, just added aa house feel but what is the class Profiler?[/quote]

I put a link to the profiler manual! I suggest you read it before asking questions!


accented with $this->input->post - El Forum - 06-07-2010

[eluser]cmarra[/eluser]
I understand you but what should I expect from the POST variables after using the class?


accented with $this->input->post - El Forum - 06-07-2010

[eluser]Clooner[/eluser]
[quote author="cmarra" date="1275937273"]I understand you but what should I expect from the POST variables after using the class?[/quote]
First line from the manual: The Profiler Class will display benchmark results, queries you have run, and $_POST data at the bottom of your pages. This information can be useful during development in order to help with debugging and optimization.