V
V
Vyacheslav2016-08-28 20:17:52
PHP
Vyacheslav, 2016-08-28 20:17:52

Are Cyrillic characters allowed in the name attribute in form fields - can there be problems?

Has anyone really tested how different browsers and servers with Russian-language field names behave when submitting forms to the server?
In one of my projects, it turned out to be very convenient to use Russian-language names in form fields, like this (very simplified example):

<?php
if ($_POST) {
  $message= "";
  foreach ($_POST as $filedLabel => $filedValue) {
    $message.= "$filedLabel: $filedValue \n";
  }
  mail($adminEmail,  'Заявка с сайта',  $message);
}
?>

<FORM method="post">
  <input placeholder="Ваше имя" name="Имя"><br/>
  <input placeholder="Ваш телефон" name="Телефон"><br/>
  <textarea placeholder="Вопрос, комментарий, сообщение" name="Сообщение"></textarea><br/>
  <button type="submit">Отправить</button>
</FORM>

It is convenient if there are many different forms with different sets of fields. In this case, the script that sends the e-mail can take the field names directly from the $_POST input array and compose the appropriate email on the fly.
Question:
Can such an approach (with Russian field names and a form sent by the POST method) meet any problems in some browsers, client or server OS?
The server uses Nginx, Apache, PHP5+. The page itself and the entire site are encoded in UTF-8.
My local tests in different browsers seem to work correctly - the field names are correctly transferred to the server.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Enikeev, 2016-08-28
@miha872287

and how will you access the attribute when processing the form, for example, through PHP?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question