ebrahim ebrahim - 1 year ago 119
PHP Question

Hide table columns in php

I want to hide table rows with a id, for Example:
If the user requests this address: http://*.com/index.php?show=1,3
Information is displayed only in columns 1 and 3 but not 2.

<table>
<tr>
<td> 1 </td>
<td> hidden </td>
</tr>
<tr>
<td> 2 </td>
<td> shown </td>
</tr>
<tr>
<td> 3 </td>
<td> shown </td>
</tr>
</table>

Answer Source

If your ids in the table is dynamic then you can do this.

$temp=explode(',',$_GET['show']);
<?php if(in_array('1',$temp) { ?>
<tr>
<td>1</td>
<td> something</td>
</tr>
<?php } ?>

Just change '1' to your dynamic variable.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download