HTML HTML Forms Choosing Options Radio Buttons

My Radio Buttons not switching to the other option but the name value is the same like in the video but it not working

<!DOCTYPE html>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Sign Up Form</title>
        <link rel="stylesheet" href="css/normalize.css">
        <link href=',300' rel='stylesheet' type='text/css'>
        <link rel="stylesheet" href="css/main.css">

      <form action="indexhtml" method="post">
      <h1>Sign Up</h1>

       <legend><span class="number">1</span>Your basic info</legend>
      <label for="name">Name:</label>
      <input   type="text" id="name" name="user_name">

      <label for="email">Email:</label>
      <input   type="email" id="email" name="user_email">

      <label for="password">Password:</label>
      <input   type="password" id="password" name="user_password">

       <input type="radio" id="under_13" value="user_age"><label for="under_13" class="light">Under 13</label><br>

       <input type="radio" id="over_13"  value="user_age"><label for="over_13" class="light">13 or Older</label>


     <legend><span class="number">1</span>Your Profile</legend>
      <label for="bio">Comment:</label>
      <textarea id="bio"  name="user_bio"> </textarea>

       <label for="job">Job role</label>
       <select id="job"name="name_job">
        <optgroup label="web">
        <option value="web_developer">web developer</option>
        <option value="rails_developer">rails developer</option>
        <option value="frontend_developer">front-end developer</option>
        <option value="php_developer">php developer</option>
        <option value="wordpress_developer">word press developer</option>

        <optgroup label="mobile">
        <option value="ios_developer">ios developer</option>

       <optgroup label="other">
       <option value="freelancer">freelancer</option>
       <option value="busmiess_owner">php developer</option>


      <button type="submit"> Sign Up</button>



2 Answers

This should fix it:

<input type="radio" id="under_13" name="user_age" value="under_13"> <label for="under_13" class="light">Under 13</label><br>
<input type="radio" id="over_13"  name="user_age" value="over_13"> <label for="over_13" class="light">13 or Older</label>

The input 'id' attribute must match the label 'for' attribute. The 'name' attribute must be the same for each item in a radio group to ensure only one item can be selected. The 'value' attribute is what is submitted as the selected value when the form is submitted.

Hope this helps.

Fernando Gomez
Fernando Gomez
18,527 Points

Amon, the problem is in your value and id. switch those around like this, but also change id to name:

<input type="radio" value="under_13" name="user_age"><label for="under_13" class="light">Under 13</label><br>

<input type="radio" value="over_13"  name="user_age"><label for="over_13" class="light">13 or Older</label>```