I have an array which i use to dynamically create a table. I have a name=value pair (Server=server.alias) which values are being extracted and would like to make it hyperlinked to another webpage.
What I need help is figuring out the code to map the alias name with a specific href link which I think I will have to hard code. The href link is different for each alias, so there is no pattern there.
Would an if statement be appropriate for this? Any other suggestions to do this? Thank you.
Expected Output:
Server
----------------
server1.alias <-- hreflink = http://server1.name.com:/9999
server2.alias <-- hreflink = http://server2.name.colo.com:/2999
My code so far generating the dynamic rows look like this:
$keys = array('Server');
echo '<table><tr>';
foreach ($keys as $column)
echo '<th>' . $column . '</th>';
echo '</tr>';
foreach ($data as $row){
echo '<tr>';
foreach ($keys as $column)
if (isset($row[$column])){
echo '<td>' . $row[$column];
} else {
echo '<td>' . '' . '</td>';
}
}
echo '</table>';