Hello .
I'm not sure what is wrong in my code. I'm trying to expand table row to see more details from mysql query . The idea is to click 'show / hide ' link and on that onclick event the row below need to be expanded.Here is my code :
<?php
while ($row = mysql_fetch_assoc($get))
{
$customer = $row['customer_id'];
//get data
$the_user = $row['username'];
$the_team = $row['team'];
$name = $row['customer_name'];
$phone =$row['customer_phone'];
$email = $row['customer_email'];
$product = $row['customer_product'];
$comment = $row['customer_comment'];
$date = $row['date'];
$show_date = date("H:i d/M/Y",$date);
$i = $i +3;
if($i % 2 )
{
$bg_color = "#996600";
$font = "#000000";
}
else
{
$bg_color = "#666699";
$font = "#ffffff";
}
echo '
<tr bgcolor = '.$bg_color.' style="font-size:12px" align="middle">
<td>
<font color ='.$font.'>
'.$name.'
</font>
</td>
<td>
<font color ='.$font.'>
'.$phone.'
</font>
</td>
<td>
<font color ='.$font.'>
'.$email.'
</font>
</td>
<td>
<font color ='.$font.'>
'.$product.'
</font>
</td>
<td align="left">
<font color ='.$font.'>
'.$comment.'
</font>
</td>
<td>
<font color ='.$font.'>
'.$show_date.'
</font>
</td>
<td>
<font color ='.$font.'>
'.$the_user.'
</font>
</td>
<td>
<font color ='.$font.'>
'.$the_team.'
</font>
</td>
<td>
<font color ='.$font.'>
</font>
';?>
<script language="javascript" type="text/javascript">
function showHide (a)
{
var p = document.getElementById('p'+a);
if (p.style.display=='block')
{
p.style.display='none';
}
else
{
p.style.display='block';
}
}
</script>
<a href="#" onclick="showHide(<?php $customer; ?>)"> Show / Hide </a>
</td>
<tr id="p<?php $customer; ?>">
<td>
<?php echo $customer; ?>
</td>
</tr>
</tr>
<?php
}
?>
Thanks....