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

  • Home
  • SEARCH
  • 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 8886643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:36:26+00:00 2026-06-14T21:36:26+00:00

Ok here is my problem, and all of my ‘dirty’ code. This isn’t my

  • 0

Ok here is my problem, and all of my ‘dirty’ code. This isn’t my production code but just trying to make it work at the moment.

Basically what I need is when a user selects the Not Ok radio button it displays the textarea for that unique set which it doesn’t do right now when I select Not Ok it gives the textarea’s for all the entries which right now is about 13 sets of questions that get generated dynamically from a mysql database at the moment. I have a feeling it has to do something with unique id’s that are either in the wrong place in my code now, or just simply aren’t there at all. Any help is appreciated greatly.

<div data-role="collapsible" data-theme="b" data-content-theme="c">
<h3>Vehicle Check Information</h3>
<?php
$query = mysql_query("SELECT * FROM vehicle_q");
while($row = mysql_fetch_array($query)) {
    $q_title = $row['title'];
    $q_id = $row['id'];
?>

<div data-role="fieldcontain" style="border:0;">
<fieldset data-role="controlgroup">
<legend><?php echo $q_title; ?>:</legend>

<input type="radio" name="help[]" id="checkbox-1a" value="Ok" />
<label for="checkbox-1a">Ok</label>
<input type="radio" name="help[]" id="checkbox-2a" value="Not Ok" />
<label for="checkbox-2a">Not Ok</label>

</fieldset>

<div id="hidden_text-<?php echo $q_id; ?>" style="display:none;">

<script>
$(document).ready(function(){
$(":radio:eq(1)").click(function(){
$("#hidden_text-<?php echo $q_id; ?>").show(500);
});
$(":radio:eq(0)").click(function(){
$("#hidden_text-<?php echo $q_id; ?>").hide(500);
});
});
</script>

<fieldset data-role="fieldcontain">
<label for="<?php echo $q_title; ?>_t">Explain the Deficiency(If any):</label>
<textarea name="text_a[]" id="<?php echo $q_title; ?>_t"></textarea>
</fieldset>
</div>
</div>
<input type="hidden" name="q_title1[]" value="<?php echo $q_title; ?>" />

<?php
}
?>

</div>
  • 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-06-14T21:36:27+00:00Added an answer on June 14, 2026 at 9:36 pm

    The other 2 answers are ways to fix your issue. As a side, here is possibly why it is happening. When you are using –

    $(":radio:eq(1)").click(function()
    $(":radio:eq(0)").click(function()
    

    You are using a click listener that just checks for if ‘any’ radio button with that index position was clicked on your page. So any button with 1 index position will make every $(":radio:eq(1)").click(function() execute.

    Edit –

    You would want to change your radio button ids, as (1) they will not be unique as you repeat them with each while() loop, and (2) you could use it to check if that specific radio buttton was clicked.

    Try changing it to –

    ...
    <input type="radio" name="help[]" id="checkbox-1a-<?php echo $q_id; ?>" value="Ok" />
    <label for="checkbox-1a">Ok</label>
    <input type="radio" name="help[]" id="checkbox-2a-<?php echo $q_id; ?>" value="Not Ok" />
    <label for="checkbox-2a">Not Ok</label>
    
    </fieldset>
    
    <div id="hidden_text-<?php echo $q_id; ?>" style="display:none;">
    
    <script>
    $(document).ready(function(){
    $("#checkbox-2a-<?php echo $q_id; ?>").click(function(){
    $("#hidden_text-<?php echo $q_id; ?>").show(500);
    });
    $("#checkbox-1a-<?php echo $q_id; ?>").click(function(){
    $("#hidden_text-<?php echo $q_id; ?>").hide(500);
    });
    });
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to solve this problem all day but haven't got any
Maybe I'm looking at this problem all wrong, but here goes. We have a
It is Hallowe'en after all. Here's the problem: I'm maintaining some old-ish J2EE code,
Here is the code that demonstrates my problem (All in the same namespace): public
I found this problem all over the net but no answer yet, so maybe
hi all i have implemented code as shown in the below here problem is
I have problem here, I need all the stuffs inside this $_SESSION['cart'] thing and
Here is problem I'm trying to solve. It's for logistics company. I got all
Here's a skeleton Makefile just to make it easier to describe the problem: all_tests
Here is my problem all months start from day 1 but month 7 2012

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.