I need the imput tag to have a double name as a class, for example:

<input class="firstClass secondClass" type="radio" name="firstNane secondName" id="step1-5" value="Размер автомобиля: Джип"> 

  • And what one name did not please? - andreymal
  • for what purpose do you need it? - teran

2 answers 2

The standard says the following

It is not necessary to have an empty string. Any value for the name _charset_ is special:

which in Russian sounds like

If an attribute is specified, its value must not be an empty string. It is allowed to specify any non-empty value, except for the _charset_ value.

Therefore, you can actually specify any line with a space, even though there isn’t. When sending the form to the server, you will receive the corresponding key in the $_POST array (for php). But you will not be able to access this element as either firstName or lastName separately, only the whole. In general, in js / jquery, you can specify a selector as $("input[name*='firstName']") , but, frankly, there is no particular point in all this.

    Can be passed as an array

     <input name="xd[]" value="firstName"/> <input name="xd[]" value="lastName"/> <input name="xd[]" value="testName"/> 

    Process

     $_POST['xd'][0] == 'firstName' $_POST['xd'][2] == 'testName'