Welcome Guest, Not a member yet? Register   Sign In
accented with $this->input->post
#1

[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
#2

[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");
}
#3

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

[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'); ....
#5

[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);
#6

[eluser]Clooner[/eluser]
btw what does your profiler say on the post data?
http://ellislab.com/codeigniter/user-gui...iling.html
#7

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

[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!
#9

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

[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.




Theme © iAndrew 2016 - Forum software by © MyBB