Se questo puo' aiutare.
Codice PHP:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
<?php ob_start(); ?>
<table cellpadding="4">
<tr id="riga1">
<td input type="button" value="INSERIMENTO" onClick="top.location.href = 'inserimento_nota.php'">1</td>
</tr>
<tr id="riga2">
<td input type="button" value="INSERIMENTO" onClick="top.location.href = 'inserimento_nota.php'">2</td>
</tr>
<tr id="riga3">
<td input type="button" value="INSERIMENTO" onClick="top.location.href = 'inserimento_nota.php'">3</td>
</tr>
<tr id="riga4">
<td input type="button" value="INSERIMENTO" onClick="top.location.href = 'inserimento_nota.php'">4</td>
</tr>
<tr id="riga5">
<td input type="button" value="INSERIMENTO" onClick="top.location.href = 'inserimento_nota.php'">5</td>
</tr>
<tr id="riga6">
<td input type="button" value="INSERIMENTO" onClick="top.location.href = 'inserimento_nota.php'">6</td>
</tr>
<tr id="riga7">
<td input type="button" value="INSERIMENTO" onClick="top.location.href = 'inserimento_nota.php'">7</td>
</tr>
<tr id="riga8">
<td input type="button" value="INSERIMENTO" onClick="top.location.href = 'inserimento_nota.php'">8</td>
</tr>
<tr id="riga9">
<td input type="button" value="INSERIMENTO" onClick="top.location.href = 'inserimento_nota.php'">9</td>
</tr>
<tr id="riga10">
<td input type="button" value="INSERIMENTO" onClick="top.location.href = 'inserimento_nota.php'">10</td>
</tr>
</table>
<?php
$tabella = ob_get_contents();
ob_end_clean();
?>
<?php
print " 1 - mettiamo che il tipo di user = '1' non possa vedere le righe 4 6 7 10<br/>";
$array = array(4,6,7,10);
$pippo = $tabella;
foreach($array as $value) {
$a = "~<tr id=\"riga$value\">(.*?)</tr>~msi";
$pippo = preg_replace($a,"",$pippo);
}
print $pippo;
print "<hr/>";
print " 2 - mettiamo che il tipo di user = '2' non possa vedere le righe 1 2 5 7<br/>";
$array = array(1,2,5,7);
$pippo = $tabella;
foreach($array as $value) {
$a = "~<tr id=\"riga$value\">(.*?)</tr>~msi";
$pippo = preg_replace($a,"",$pippo);
}
print $pippo;
print "<hr/>";
print " 3 - mettiamo che il tipo di user = '3' non possa vedere le righe 5 6 7 8<br/>";
$array = array(5,6,7,8);
$pippo = $tabella;
foreach($array as $value) {
$a = "~<tr id=\"riga$value\">(.*?)</tr>~msi";
$pippo = preg_replace($a,"",$pippo);
}
print $pippo;
print "<hr/>";
?>
</body>
</html>