Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 416239
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T18:27:38+00:00 2026-05-12T18:27:38+00:00

How can I make radio buttons to be selected when I click on any

  • 0

How can I make radio buttons to be selected when I click on any of two labels in front of that radio button?

I have following code for radio buttons:

<div class="label_main" style="width:350px">
    <div class="label_radio">
      <input type="radio" name="group1" id="group1" value="0" 
       <?php if($r0==0) { ?>
       checked="checked"
       <?php  } ?>
      />
    </div>
    <div class="label_top">
      <label for="group1">First Option </label>
    </div>
    <div class="label_desc">
      <label for="group1">This is first option </label>
    </div>
  </div>
      </div> 

  <div class="label_main" style="width:350px">
    <div class="label_radio">
      <input type="radio" name="group1" id="group1" value="1"
       <?php if($r0==1) { ?>
       checked="checked"
       <?php  } ?>
      />
    </div>
    <div class="label_top">
      <label for="group1">Second Option </label>
    </div>
    <div class="label_desc">
      <label for="group1">This is Second Option </label>
    </div>
  </div>          

Only problem I am having if I change radio ID it work fine, but I need same id cause I need its value at the end to save in database.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T18:27:39+00:00Added an answer on May 12, 2026 at 6:27 pm

    You’re confusing the name attribute with the id attribute.

    They should each have the same name, but a different id.

    For example:

    <input type="radio" name="group1" id="group1_0" value="0">
    <input type="radio" name="group1" id="group1_1" value="1">
    
    <label for="group1_0">CLicky 0</label>
    <label for="group1_1">CLicky 1</label>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

On the click of a button, how can i make all the hidden radio
I'm trying to make radio buttons that when you have them active, it displays
I have two hidden radio buttons and one visible button. Clicking this button should
Can someone tell me how I can make the following output? I have a
I have a form that has two views. These views are controlled by radio
I have a few radio buttons that belong to the same category, but I
I am wondering whether you can make a button, function like a HTML Radio
I have a form with radio buttons and a text field. How can I
I have a span which contains 2 radio buttons and 2 labels. When a
I have a use case where the the number of radio buttons can be

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.