type radio with different names

0

I would like to know how I can do for when one radio is marked the other uncheck, but the two with different names.

<span style="text-shadow: 0 0 7px blue; color: white; font-size: 15px; font-family: 'Kanit', sans-serif;">USA</span>
<input type="radio" id="usa" name="usa" value="usa">
<span style="text-shadow: 0 0 7px blue; color: white; font-size: 15px; font-family: 'Kanit', sans-serif;">BRAZIL</span>
<input type="radio" id="brazil" name="brazil" value="brazil">
    
asked by anonymous 19.02.2018 / 19:29

1 answer

0

There is no way, you have to give the same name to each, the name is the category of the item and not the value, the value is what PHP will receive, type, you what changes is value .

That is, name is "Land" category (Country, origin, etc.) And the value is the selection that the user makes user / client.

Example:

<form onchange="alert('Seu país é '+this.pais.value+'\r\nForma de pagamento: '+this.pagamento.value)">
<p>Seu país atual:</p>
  <input type="radio" name="pais" value="BRASIL" checked>Brasil<br>
  <input type="radio" name="pais" value="URUGUAI">Uruguai<br>
  <input type="radio" name="pais" value="E.U.A">Estados Unidos da América<br>
<!-- Forma de pagamento -->
<p>Escolha sua forma de pagamento:</p>
  <input type="radio" name="pagamento" value="CREDCARD" checked>Cartão de Crédito<br>
  <input type="radio" name="pagamento" value="CHEQUE">Cheque nominal<br>
  <input type="radio" name="pagamento" value="BOLETO">Boleto<br>
</form>

Used Chebox :

<form>
  <input type="checkbox" name="pais1" value="Brasil">Brasil<br>
  <input type="checkbox" name="pais2" value="EUA">Estados Unidos da América<br>
</form>
    
19.02.2018 / 20:15