Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Two radio buttons on at the same time

Hello Can you tell why I am allowed to select two radio buttons in this code

<html>
  <head><title>Survey</title>
  <body>
     <h3>Please Enter the following Information: </h3>

  <form method= "post" action="/~fmccown/cgi-bin/printinfo.cgi">
    <input type ="hidden" name="input-source" value="survey2.html" />
     <p>
      Name: <input type="text" name="name" size="30" />
      </p><p>
      Classification:
      <select name="class">
        <option>Freshman</option>
    <option selected="selected">Sophomore</option>
    <option>Junior</option>
    <option>Senior</option>
     </select>
    </p><p>
      Gender:
        <input type="radio" name="gender" value="M" checked="checked" />Male
    <input type="radio" name="gender" value="F" />Female
    </p><p>
      Email address: <input type="text" name="email" size="30" />
          </p><p>
    Password: <input type="password" name="pword" />
    </p><p>
    What are your favorite computer classes?
    <br /> &nbsp;
    <label>
    <input type="checkbox" name="class-int" />Internet Development &nbsp;
    </label>
    <label>
    <input type="checkbox" name="class-net" />Networking &nbsp;
    </label>
    <label>
    <input type="checkbox" name="class-gui" />GUI &nbsp;
    </label>
    <label>
    <input type="checkbox" name="class-oop" />OOP
    </label>
    </p><p>
    Are you graduating this spring?
    <label>
    <input type="radio" name="grad-yes" value="Yes" />Yes
    </label>
    <label>
    <input type="radio" name="grad-no" value="Yes" />No
    </label>
    </p><p>
      <input type="submit" value="Submit Survey" />
      <input type="reset" value="Clear Form" />
   </p>
   </form>
  <p>
    Thank You!
  </p>
  </body>
  </html>
like image 989
Steffan Harris Avatar asked Dec 10 '22 05:12

Steffan Harris


1 Answers

These two elements should probably have the same name:

<input type="radio" name="grad-yes" value="Yes" />
<input type="radio" name="grad-no" value="Yes" />
like image 77
Matt Ball Avatar answered Dec 27 '22 11:12

Matt Ball