Jump to content

Recommended Posts

All,

 

I am taking the output for every title in my Database and displaying it in a box. Within that box I am providing the opportunity to open another box with further content inside. The problem with the code below is that when you click on the expand button it expands in all the boxes, not just the one you are clicking in. I don't understand why this is happening when everything else is ok - any fixes and explanations are greatly appreciated:

// GOING THROUGH THE DATA
 if($result->num_rows > 0) {
    
    //echo "<hr />";
while($fetch=mysqli_fetch_array($result)) {
$title=$fetch['title'];
$feed_rss=$fetch['url'];
$content_id=$fetch['content_id'];
$source_image=$fetch['source_image'];     
$item_id = $fetch['item_id'];
$item_title = $fetch['item_title'];
$item_date = $fetch['fetch_date'];
$item_description = $fetch['item_description'];
$item_url = $fetch['item_url'];

/////////////////////////////////////////////////////////////////////////////////
//

?>
    <div class="box col5">
        <?php
    $query_string = "cid={$content_id}&t={$item_id}&item_title={$item_title}";
$url_query_string = "http://www.disciply.com/article/index.php?" . $query_string;            
/*Start of dynamic content open*/
echo "<p>$title</p>";
echo "<img src=$source_image />";
echo "<p>item_url = $item_url</p>";
?>
        <div class="panel_button" style="display: visible;"><img src="../images/expand.png"  alt="expand"/> <a href="#"><?php echo $item_title; ?></a></div>
 <div class="panel_button" id="hide_button" style="display: none;"><img src="../images/collapse.png" alt="collapse" /> <a href="#">Hide</a>
 <object type="text/html" data='<?php echo $item_url;?>' width="100%" height="800px" style="overflow:auto;border:5px ridge blue">
    </object>  
    </div>
    </div>

Edited by genista
Link to comment
https://forums.phpfreaks.com/topic/290001-problem-with-div-in-loop/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.