<form action="test_2.php" method="post"> <span style="margin-left: 250px">binary</span><span style="margin-left: 30px">decimal</span> <span style="margin-left: 30px">hexadecimal</span> <br> Number 1: <input type="text" name="number_1"> <input type="radio" name="type" value="binary" style="margin-left: 15px"> <label><input type="radio" name="type" value="decimal" style="margin-left: 56px" checked> <label><input type="radio" name="type" value="hexadecimal" style="margin-left: 80px"> <br> Number 2: <input type="text" name="number_2"> <input type="radio" name="type" value="binary" style="margin-left: 15px"> <input type="radio" name="type" value="decimal" style="margin-left: 56px" checked> <input type="radio" name="type" value="hexadecimal" style="margin-left: 80px"> <br> <input type="submit"> </form> 

There is such a form where 2 numbers are entered and their types are selected. So the question is: what to write so that the type of the first and second numbers are chosen separately? I tried to tie each radio to the field, but to no avail. It works if you create 2 forms, but this is not an option.

  • If you are given an exhaustive answer, mark it as correct (a daw opposite the selected answer). - Nicolas Chabanovsky

1 answer 1

Give the radio button groups different name attributes:

 <form action="test_2.php" method="post"> <span style="margin-left: 250px">binary</span> <span style="margin-left: 30px">decimal</span> <span style="margin-left: 30px">hexadecimal</span> <br> Number 1: <input type="text" name="number_1"> <input type="radio" name="type_1" value="binary" style="margin-left: 15px"> <input type="radio" name="type_1" value="decimal" style="margin-left: 56px" checked> <input type="radio" name="type_1" value="hexadecimal" style="margin-left: 80px"> <br> Number 2: <input type="text" name="number_2"> <input type="radio" name="type_2" value="binary" style="margin-left: 15px"> <input type="radio" name="type_2" value="decimal" style="margin-left: 56px" checked> <input type="radio" name="type_2" value="hexadecimal" style="margin-left: 80px"> <br> <input type="submit"> </form> 

  • Thank. Here I am a fool ... - Jesse Livermore