I got 3 PHP arrays which I've put inside a HTML table. The table headers are correctly displayed but the data not. That are the <td>'s. The table rows and <td>'s are displayed under each other and not in the columns. How can I fix this?
Here is my code:
echo '<table border="1"><tr><th><b>Gebruikersnaam</b></th><th>Functie</th><th>E-mailadres</th></tr>';
sort($result);
foreach($result as $key)
{
echo '<tr>';
echo '<td>'.$key.'</td>';
echo '</tr>';
}
foreach ($result as $key=>$function)
{
$check = $adldap->user()->info($function, array("title"));
$title = $check[0]['title'][0];
if(empty($title)) {
echo '<td>Geen functie</td>';
} else {
echo '<tr>';
echo '<td>'.$title.'</td>';
echo '</tr>';
}
}
foreach ($result as $key=>$function)
{
$check = $adldap->user()->info($function, array("mail"));
$title = $check[0]['mail'][0];
echo '<tr>';
echo '<td>'.$title.'</td>';
echo '</tr>';
}
echo '</table>';
}
And here is an idea what my problem is:
| Column 1 | Column 2 | Column 3 |
----------------------------------------------------
| value1 | | |
|---------------------------------------------------
| value2 | | |
|---------------------------------------------------
| value3 | | |
|---------------------------------------------------
| value4 etc | | |
|---------------------------------------------------
All the arrays appear in the first column. I used <tr> <td> nothing works.
EDIT This is the $result variable. (Using the ADLDAP php class).
$result = $adldap->group()->members($groepbekijken, $sorted = true);