Jump to content

[SOLVED] Display Issue


ainoy31

Recommended Posts

Hello-

 

I have a dynamic page that list all records of a telephone call made.  Under each telephone record is a sub page that entails more information about the call.  I am using javascript to hide and display the sub page of each call.  I have attached a screenshot.  Here is my javascript:

 

function ToggleVisibility(id) 
{
       var e = document.getElementById(id);
       if(e.style.display == '')
       {
          e.style.display = 'none';
       }
       else
       {
            e.style.display = '';
       }
}

 

Here is my php page to display the call records.

<table width="100%" border="0" cellpadding="0" cellspacing="0" class="Data">
   <tr>
    <th><a href="#">Number<img src="images/point.gif" class="ColumnSort Descending" alt="" /></a></th>
    <th><a href="#">Destination<img src="images/point.gif" class="ColumnSort" alt="" /></a></th>
    <th><a href="#">Call Start<img src="images/point.gif" class="ColumnSort" alt="" /></a></th>
    <th><a href="#">Duration<img src="images/point.gif" class="ColumnSort" alt="" /></a></th>
    <th><a href="#">Charge<img src="images/point.gif" class="ColumnSort" alt="" /></a></th>
   </tr>
   <?
   for($x = 0; $x < $num; $x++)
   {	
        variable data logic here.....
<tr>
    <td><a href="" onclick="ToggleVisibility('detail0'); return false;"><img src="images/point.gif" height="9" width="9" class="RowToggler Expand" alt="" /><?=$destNum;?></a></td>
    <td><?=$destName;?></td>
    <td><?=$startDate;?>, <?=$startTime;?></td>
    <td><?=$callDuration;?>m</td>
    <td><?=$callCharge;?></td>
   </tr>
   <tr class="Supplement" id="detail0" style="display: none;">
    <td colspan="5">
     <table width="100%" border="0" cellpadding="0" cellspacing="0">
      <tr>
       <td class="Label">Destination Detail:</td>
       <td width="100%"><?=$destName;?></td>
      </tr>
      <tr>
       <td class="Label">Amount Applied to Bucket Plan:</td>
       <td><?=$callDuration;?></td>
      </tr>
      <tr>
       <td class="Label">Invoice Date:</td>
       <td><?=$invoiceDate;?></td>
      </tr>
      <tr>
       <td class="Label">Tax Jurisdiction:</td>
       <td><?=$tax;?></td>
      </tr>
     </table>
<?}?>

 

My problem is that since I am using a for loop to get all the records and displaying them, if I click on the any records, only the subpage of first record is displayed.  I hope this makes sense and not confusing.  Much appreciation.  AM

 

 

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/112607-solved-display-issue/
Share on other sites

You have to change the ID for each row....

 

<table width="100%" border="0" cellpadding="0" cellspacing="0" class="Data">
   <tr>
    <th><a href="#">Number<img src="images/point.gif" class="ColumnSort Descending" alt="" /></a></th>
    <th><a href="#">Destination<img src="images/point.gif" class="ColumnSort" alt="" /></a></th>
    <th><a href="#">Call Start<img src="images/point.gif" class="ColumnSort" alt="" /></a></th>
    <th><a href="#">Duration<img src="images/point.gif" class="ColumnSort" alt="" /></a></th>
    <th><a href="#">Charge<img src="images/point.gif" class="ColumnSort" alt="" /></a></th>
   </tr>
   <?
   for($x = 0; $x < $num; $x++)
   {	
        variable data logic here.....
<tr>
    <td><a href="" onclick="ToggleVisibility('detail<?=$x?>'); return false;"><img src="images/point.gif" height="9" width="9" class="RowToggler Expand" alt="" /><?=$destNum;?></a></td>
    <td><?=$destName;?></td>
    <td><?=$startDate;?>, <?=$startTime;?></td>
    <td><?=$callDuration;?>m</td>
    <td><?=$callCharge;?></td>
   </tr>
   <tr class="Supplement" id="detail<?=$x?>" style="display: none;">
    <td colspan="5">
     <table width="100%" border="0" cellpadding="0" cellspacing="0">
      <tr>
       <td class="Label">Destination Detail:</td>
       <td width="100%"><?=$destName;?></td>
      </tr>
      <tr>
       <td class="Label">Amount Applied to Bucket Plan:</td>
       <td><?=$callDuration;?></td>
      </tr>
      <tr>
       <td class="Label">Invoice Date:</td>
       <td><?=$invoiceDate;?></td>
      </tr>
      <tr>
       <td class="Label">Tax Jurisdiction:</td>
       <td><?=$tax;?></td>
      </tr>
     </table>
<?}?>

Link to comment
https://forums.phpfreaks.com/topic/112607-solved-display-issue/#findComment-578298
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.