Form/table.php

54 lines
1.4 KiB
PHP
Raw Normal View History

2024-05-17 14:40:45 +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>
<td> <?php echo $tok = strtok($buf, ";"); ?> </td>
<td> <?php echo $tok = strtok(";"); ?> </td>
<td> <?php echo $tok = strtok(";"); ?> </td>
<td> <?php echo $tok = strtok(";"); ?> </td>
<td> <?php echo $tok = strtok(";"); ?> </td>
</tr>
<?php
}
?>
<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>