koolsamule
Programmer
Hi Guys,
I have a PHP loop region, which repeats all completed projects for each customer, then displays all jobsheets linked to those projects.
I have a javascript show/hide function, which will only show the jobsheets when the project link is clicked.
Without this javascript, the PHP loop works perfectly, but all the information is displayed. How can I use the show/hide function and still show all the jobsheets for completed projects?
function toggle2(id, link) {
var e = document.getElementById(id);
if (e.style.display == '') {
e.style.display = 'none';
link.innerHTML = '<img src="../Images/plus.gif" border="0" >';
} else {
e.style.display = '';
link.innerHTML = '<img src="../Images/minus.gif" border="0" >';
}
}
<table>
<tr>
<th>Project / Job</th>
<th>Language</th>
<th>Words (Net)</th>
<th>Shipped</th>
</tr>
<?php
$previousProject = '';
if ($totalRows_rsComplete_Cust > 0) {
// Show if recordset not empty
while ($row_rsComplete_Cust = mysql_fetch_assoc($rsComplete_Cust)) {
if ($previousProject != $row_rsComplete_Cust['projid']) {
// for every user, show the user name
?>
<tr>
<td colspan="4"><a href="#" onclick="toggle2('<?php echo $row_rsComplete_Cust['projid']; ?>', this)"><img src="../Images/plus.gif" border="0" /></a><?php echo $row_rsComplete_Cust['projid']; ?></td>
</tr>
<?php $previousProject = $row_rsComplete_Cust['projid']; } ?>
<tr id="<?php echo $row_rsComplete_Cust['projid']; ?>" style="display:none">
<td><a href="jobsheet_details.php?id=<?php echo $row_rsComplete_Cust['jobid']; ?>&proj=<?php echo $row_rsComplete_Cust['projid']; ?>"><?php echo $row_rsComplete_Cust['jobname']; ?></a></td>
<td>LANGUAGE</td>
<td>WORD NET</td>
<td>YES / NO</td>
</tr>
<?php }} // Show if recordset not empty ?>
</table>
I have a PHP loop region, which repeats all completed projects for each customer, then displays all jobsheets linked to those projects.
I have a javascript show/hide function, which will only show the jobsheets when the project link is clicked.
Without this javascript, the PHP loop works perfectly, but all the information is displayed. How can I use the show/hide function and still show all the jobsheets for completed projects?
function toggle2(id, link) {
var e = document.getElementById(id);
if (e.style.display == '') {
e.style.display = 'none';
link.innerHTML = '<img src="../Images/plus.gif" border="0" >';
} else {
e.style.display = '';
link.innerHTML = '<img src="../Images/minus.gif" border="0" >';
}
}
<table>
<tr>
<th>Project / Job</th>
<th>Language</th>
<th>Words (Net)</th>
<th>Shipped</th>
</tr>
<?php
$previousProject = '';
if ($totalRows_rsComplete_Cust > 0) {
// Show if recordset not empty
while ($row_rsComplete_Cust = mysql_fetch_assoc($rsComplete_Cust)) {
if ($previousProject != $row_rsComplete_Cust['projid']) {
// for every user, show the user name
?>
<tr>
<td colspan="4"><a href="#" onclick="toggle2('<?php echo $row_rsComplete_Cust['projid']; ?>', this)"><img src="../Images/plus.gif" border="0" /></a><?php echo $row_rsComplete_Cust['projid']; ?></td>
</tr>
<?php $previousProject = $row_rsComplete_Cust['projid']; } ?>
<tr id="<?php echo $row_rsComplete_Cust['projid']; ?>" style="display:none">
<td><a href="jobsheet_details.php?id=<?php echo $row_rsComplete_Cust['jobid']; ?>&proj=<?php echo $row_rsComplete_Cust['projid']; ?>"><?php echo $row_rsComplete_Cust['jobname']; ?></a></td>
<td>LANGUAGE</td>
<td>WORD NET</td>
<td>YES / NO</td>
</tr>
<?php }} // Show if recordset not empty ?>
</table>