0

I have a simple HTML form with 2 fields, name and email.

I'm trying to prevent users from submitting invalid names. The only characters allowed are:

  • letters
  • spaces
  • these special characters: àäçéèïöü

I get the name using a php $_REQUEST variable and store it in $name.

My preg_match is the following preg_match("/^[a-zA-Z àäçéèïöü]+$/", $name).
When I test it in my php code, it works.
But when I test it upon my $_REQUEST variable, it doesn't (though it's displayed correctly in the browser).

For example, if my $_REQUEST variable contains "Jeremy", it works, but if it contains "Jérémy", it doesn't.

Thanks for your help.

4

1 回答 1

0

由于将评论标记为答案的功能请求仍然被拒绝,因此我在此处复制上述解决方案。

您是否尝试过使用 utf8_encode($name)?– 坎皮泰利

于 2014-06-05T06:12:16.270 回答