FormClasses/table.php

58 lines
1.5 KiB
PHP
Raw Permalink Normal View History

2024-05-20 15:11:17 +03:00
<!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");
2024-06-14 15:55:36 +03:00
function PrintStringOfTable($file): void
2024-05-20 15:11:17 +03:00
{
$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>
2024-05-21 17:06:42 +03:00
<th>Фамилия</th>
<th>Имя</th>
<th>Отчество</th>
2024-05-20 15:11:17 +03:00
<th>Дата рождения</th>
<th>Пол</th>
2024-05-21 17:06:42 +03:00
<th>Код страны</th>
2024-05-20 15:11:17 +03:00
<th>Номер Телефона</th>
<th>Email</th>
</tr>
<?php
while (!feof($file)) {
PrintStringOfTable($file);
} // while
?>
</table>
<?php fclose($file); ?>
</body>
</html>