0

I've been at this for a few hours now and I can't seem to get the check boxes to do anything other then be there cosmetically. I need it to have the user input which one they one and then press the submit button to get what they inputted submitted.

<tr>
                    <td>
                        <input type = 'checkbox' name = 'area2d' value = 'area' id = 'area'>
                        <label for = 'area'> Area </label>
                    </td>
                </tr>
                <tr>
                    <td>
                        <input type = 'checkbox' name = 'perimeter' value = 'perimeter' id = 'perimeter'>
                        <label for = 'perimeter'> Perimeter </label>
                    </td>
                    <td>

                        
                    </td>
                    <td>
                        <input type = 'submit' name = 'area2d' id = 'area' value = 'Submit Query'>
                        <input type = 'submit' name = 'perimeter' id = 'perimeter' value = 'Submit Query'>
                        <input type= 'reset' name= 'Reset' id= 'Reset' value= 'Reset'>
                    </td>
                </tr>

The start of everything works just fine but I just can't seem to figure out how to link it together properly.

<tr>
                    <td>
                        <input type = 'radio' name = 'shape' value = 'circle' id = 'shapeT'>
                        <label for = 'shapeT'> Triangle </label>
                    </td>
                    <td>
                        <label for = 'heightBox'> Height </label>
                    </td>
                    <td>
                        <input type = 'number' name = 'height2d' id = 'heightBox'>
                    </td>
                </tr>
                <tr>
                    <td>
                        <input type = 'radio' name = 'shape' value = 'circle' id = 'shapeR'>
                        <label for = 'shapeR'> Rectangle </label>
                    </td>
                    <td>
                        <label for = 'widthBox'> Width </label>
                    </td>
                    <td>
                        <input type = 'number' name = 'width2d' id = 'widthBox'>
                    </td>
                </tr>
                <tr>
                    <td>
                        <input type = 'radio' name = 'shape' value = 'circle' id = 'shapeC'>
                        <label for = 'shapeC'> Circle </label>
                    </td>
                    <td>
                        <label for = 'radiusBox'> Radius </label>
                    </td>
                    <td>
                        <input type = 'number' name = 'radius2d' id = 'radiusBox'>
                    </td>
                </tr>

1 Answers1

0

You don't want to have form elements with duplicate name attributes. This post says that only the last element with a given name will be available in the POST object

Circle B
  • 1,616
  • 3
  • 26
  • 45