FormClasses/table.php
2024-05-21 17:06:42 +03:00

58 lines
1.5 KiB
PHP

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Information table</title>
<style>
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
th {
padding: 10px;
}
td {
padding: 5px;
text-align: left;
}
tr:hover {background-color: #d6eeee}
</style>
</head>
<body>
<?php
$file = fopen("Information.txt", "r");
function PrintStringOfTable($file)
{
$buf = fgets($file, filesize("Information.txt")); ?>
<tr>
<?php $tok = strtok($buf, ";\n");
while ($tok != null) { ?>
<td> <?php echo $tok ?> </td>
<?php $tok = strtok(";\n");
} // while
?>
</tr>
<?php
} // PrintStringOfTable
?>
<caption>Инфрмацмонная таблица </caption>
<table style="width: 100%">
<tr>
<th>Фамилия</th>
<th>Имя</th>
<th>Отчество</th>
<th>Дата рождения</th>
<th>Пол</th>
<th>Код страны</th>
<th>Номер Телефона</th>
<th>Email</th>
</tr>
<?php
while (!feof($file)) {
PrintStringOfTable($file);
} // while
?>
</table>
<?php fclose($file); ?>
</body>
</html>