greenCountry Posted January 30, 2008 Share Posted January 30, 2008 hello everyone, This is important,I am trying to post some spanish characters from a form on a page and i am comparing those spanish characters to the same letters on the same page but on strcmp the return is not zero.I don't know what is wrong some problem with the post method i guess or strcmp i don't know....Please help....here is the code... <html><body><?php echo(strcmp('í',$_POST['check'])); ?> <form action="./index.php" method="post"> <input type="text" name="check"> <input type="submit" name="go" > </form> </body></html> the name of the file is index.php and i am typing í in the text box before pressing submit.the result is not coming as zero but -1.The result is not coming for any of spanish or special characters like ¿,ñ,ü how to solve it that echo answer is zero. I have searched a lot on net and finally i am coming here to get some help. Quote Link to comment https://forums.phpfreaks.com/topic/88589-php-spanish-character-problem/ Share on other sites More sharing options...
effigy Posted January 30, 2008 Share Posted January 30, 2008 What character set are you using? What does print_r($_POST); show you? Quote Link to comment https://forums.phpfreaks.com/topic/88589-php-spanish-character-problem/#findComment-453554 Share on other sites More sharing options...
greenCountry Posted January 30, 2008 Author Share Posted January 30, 2008 first of all thank you for replying the result it shows is Array ( [check] => í [go] => Submit ) when i inserted print_r($_POST); in the code as you said. thank you. Quote Link to comment https://forums.phpfreaks.com/topic/88589-php-spanish-character-problem/#findComment-453571 Share on other sites More sharing options...
effigy Posted January 30, 2008 Share Posted January 30, 2008 Try following this note. Quote Link to comment https://forums.phpfreaks.com/topic/88589-php-spanish-character-problem/#findComment-453595 Share on other sites More sharing options...
greenCountry Posted January 30, 2008 Author Share Posted January 30, 2008 well regarding the character set using phpinfo() i got the apache characterset as (iso-8859-1, utf-8, utf-16, *;q=0.1) this the value of HTTP_ACCEPT_CHARSET under Apache Environment heading and (iso-8859-1, utf-8, utf-16, *;q=0.1) is the value of Accept-Charset under HTTP Request Headers heading. hope this helps you to figure out the problem thank you. Quote Link to comment https://forums.phpfreaks.com/topic/88589-php-spanish-character-problem/#findComment-453602 Share on other sites More sharing options...
greenCountry Posted January 30, 2008 Author Share Posted January 30, 2008 thank you effigy for replying i have already read this note while searching through internet.but it didn't ring any bell. i also tried using strcasecmp() but same result.If there is any thing missing please guide me to the solution. thank you. Quote Link to comment https://forums.phpfreaks.com/topic/88589-php-spanish-character-problem/#findComment-453608 Share on other sites More sharing options...
effigy Posted January 30, 2008 Share Posted January 30, 2008 This gives me "0": <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> </head> <body> <?php if ($_POST) { echo(strcmp('í',$_POST['check'])); } ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <input type="text" name="check" value="í"> <input type="submit" name="go" > </form> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/88589-php-spanish-character-problem/#findComment-453617 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.