FormClasses/table.php

55 lines
1.4 KiB
PHP
Raw 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");
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>Email</th>
</tr>
<?php
while (!feof($file)) {
PrintStringOfTable($file);
} // while
?>
</table>
<?php fclose($file); ?>
</body>
</html>