Link in table of computers that submits a field to a file

0

Good morning everyone, I have a table, which is a query select of the data of the devices I control. In it I have several elements, such as Name, MacAddress and IP, for example. In the IP column, I want a link and from it (the IP of my device) I make another query by filtering data only from that device.

Follow my code:

echo '<table>';
    echo '<tr>';
        echo '<td width="270"><center><b>NOME DO DISPOSITIVO</b></td>';
        echo '<td width="130"><center><b>IP</b></td>';
        echo '<td width="230"><center><b>MAC ADDRESS</b></td>';
        echo '<td width="130"><center><b>GATEWAY</b></td>';
        echo '<td width="130"><center><b>REDE</b></td>';
        echo '<td width="230"><center><b>MÁSCARA DA REDE</b></td>';
    echo '</tr>';
echo '</table>';

while($aux = mysqli_fetch_assoc($sql)) {  
    echo '<table id="tborpo"><tbody><tr id="tbcorpo">';
    echo '<td id="nome" width="270">'.$aux["NAME"].'</td>';
    **echo '<td width="130"><a href="fichas/ficha.php">'.$aux["IPADDR"].'</a></td>';**
    echo '<td width="230"><center>'.$aux["MACADDR"].'</td>';
    echo '<td width="130">'.$aux["IPGATEWAY"].'</td>';
    echo '<td width="130"><center>'.$aux["IPSUBNET"].'</center></td>';
    echo '<td width="230"><center>'.$aux["IPMASK"].'</center></td>';
    echo '</tr></tbody></table>';
}

'

    
asked by anonymous 30.10.2018 / 12:56

1 answer

0

To create a link in a structure like this, just put the <a> tag and insert a dynamic href whose value reflects the record you are displaying:

echo '<table>';
    echo '<tr>';
        echo '<td width="270"><center><b>NOME DO DISPOSITIVO</b></td>';
        echo '<td width="130"><center><b>IP</b></td>';
        echo '<td width="230"><center><b>MAC ADDRESS</b></td>';
        echo '<td width="130"><center><b>GATEWAY</b></td>';
        echo '<td width="130"><center><b>REDE</b></td>';
        echo '<td width="230"><center><b>MÁSCARA DA REDE</b></td>';
    echo '</tr>';
echo '</table>';

while($aux = mysqli_fetch_assoc($sql)) {

    echo '<table id="tborpo"><tbody><tr id="tbcorpo">';
        echo '<td id="nome" width="270">'.$aux["NAME"].'</td>';
        echo '<td width="130"><a href="fichas/ficha.php"><a href="/URL/DA/PÁGINA/DE/INFORMAÇÕES/DO/COMPUTADOR/?ipAddr='.$aux["IPADDR"].'">'.$aux["IPADDR"].'</a></td>';
        echo '<td width="230"><center>'.$aux["MACADDR"].'</td>';
        echo '<td width="130">'.$aux["IPGATEWAY"].'</td>';
        echo '<td width="130"><center>'.$aux["IPSUBNET"].'</center></td>';
        echo '<td width="230"><center>'.$aux["IPMASK"].'</center></td>';
    echo '</tr></tbody></table>';

}
    
30.10.2018 / 16:30