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 8419071
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T02:30:34+00:00 2026-06-10T02:30:34+00:00

Is there a way to toggle show/hide for data that is dynamically populated in

  • 0

Is there a way to toggle show/hide for data that is dynamically populated in a php loop?

I’ve been around and around trying to figure out the best way to do this, but I just don’t think I know enough to make this work and I’m not sure what best practice is.

Here’s the situation:

  1. Applicants are submitting abstracts via my website, and they go into a database
  2. Administrators log in, and view the submitted results- this is a table that has some of the basic information, but not the abstract text because that is too long.
  3. I would like to have a button (or something else!) that will show/hide the abstract text, along with giving the administrator the opportunity to assign the abstract to a session.

I thought I could just do a jquery show/hide button thing, but I can’t get it to work. Here’s the code- and note this is all development and not all security features are here. I say this because there’s inevitably someone that will comment on sessions or escape strings, etc.

<?php
include_once('xxx.php');
$conn = new connectorfunction();

$query = "SELECT * FROM tablename ORDER BY abstract_id";
$result = mysql_query($query);

$numfields = mysql_num_fields($result);
$data = array();
$flist = array();

for($i=0;$i<$numfields;$i++)$flist[] = mysql_field_name($result,$i);
$data[0] = $flist;  
while($row = mysql_fetch_assoc($result)){
  $data[] = $row;

print '
  <tr>
   <td>
   <span style="text-decoration: underline">Author:</span>
   <br />
   ' . $row['abstract_author'] .'
   </td>

  <td>
   <span style="text-decoration: underline">Title:</span> 
  ' . $row['presentation_title'] . '
  <br />
  <button>View/Assign</button>
  </td>

  <td>
  ';

  if ($row['abstract_category'] === NULL ) {
print '
      Needs Session
    ';
  }
  else {
print '
      Assigned
    ';
  }
  print'

  <tr style="display:none;">
<td colspan="3">

'. $row['abstract_text'] .'
 </tr>

 <tr style="display:none;">
   <td colspan="3">
      <form action="assign_session.php" method="post" id="form">
    <label for="abstract_category">Assign Session:
    <input type="hidden" name="abstract_id" value="'. $row['abstract_id'] .'" />
    <input type="radio" name="abstract_category" value="session1" />Session One
    <input type="radio" name="abstract_category" value="session2" />Session Two
    <input type="radio" name="abstract_category" value="notapplicable" />Not Applicable             
 <button type="submit" formaction="assign_session.php">Assign</button></label>
 </form>

   </td>
  </tr>
  ';
 }
 ?>

So you can see, there’s a button: < button >View/Assign< / button >

And there are the two < tr > with the “display: none” style.

The table looks really great when it is populated, I just need a good way for the admins to see the abstract text, but I don’t seem to be able to successfully point to jquery functions within php. Any advice on the best way to handle this?

  • 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-10T02:30:35+00:00Added an answer on June 10, 2026 at 2:30 am

    Something like this? demo

     example:<br />
        <button onClick="$('.hide').toggle();">click me</button>
        <table>
             <tr style="display:none;" class="hide">
                <td colspan="3">abstract text</td>
             </tr>
    
             <tr style="display:none;" class="hide">
               <td colspan="3">
                  <form action="assign_session.php" method="post" id="form">
                    <label for="abstract_category">Assign Session:</label>
                    <input type="hidden" name="abstract_id" value="'. $row['abstract_id'] .'" />
                    <input type="radio" name="abstract_category" value="session1" />Session One
                    <input type="radio" name="abstract_category" value="session2" />Session Two
                    <input type="radio" name="abstract_category" value="notapplicable" />Not Applicable             
                     <button type="submit" formaction="assign_session.php">Assign</button></label>
                 </form>
            </td>
          </tr>
        </table>
    

    I use jquery to toggle (show/hide) the elements you need to show/hide.

    Moreover you have several errors on this code (like you are not closing the first td, not using in the right way labels).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How to animate hide/show columns? $(#button).toggle( function() { $('#data').jqGrid('hideCol',['col1','col2','col3']); // $(bla-bla).animate({ // width: 100
I am trying to show/hide (via a toggle mechanism) only certain rows in my
Is there any way i can change the toggle function or any of it's
Is there way that I can read the file from remote server using fopen
i'm using jquery toggle to show/hide a div on different links. It shows/hides them
i have several checkboxes that when checked show a hidden div. Is there a
I've been using the standard method to hide/show a class, namely: $('.myClass').show(); // or
I know that I can make the ActionBar overlay using requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY) and can toggle/show
I would like to toggle (hide/show) several elements of my web page. All those
Is there way to get file from windows xp command prompt? I tried to

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.