This commit is contained in:
Билай Станислав 2024-05-17 14:40:45 +03:00
commit 0fe21e21b0
9 changed files with 194 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.idea

23
Information.php Normal file
View File

@ -0,0 +1,23 @@
<?php
$surname = $_REQUEST["surname"];
$name = $_REQUEST["name"];
$patronymic = $_REQUEST["patronymic"];
$gender = $_REQUEST["gender"];
$DateOfBirth = $_REQUEST["DateOfBirth"];
$countryCode = $_REQUEST["countryCode"];
$phoneNumber = $_REQUEST["phoneNumber"];
$Email = $_REQUEST["email"];
$file = fopen("Information.txt", "a");
fwrite($file,$surname . " " . $name . " " . $patronymic . "; ");
fwrite($file, $DateOfBirth . "; ");
fwrite($file, $gender . "; ");
fwrite($file, $countryCode . $phoneNumber . "; ");
fwrite($file, $Email . "; ");
fwrite($file, "\n");
fclose($file);

7
Information.txt Normal file
View File

@ -0,0 +1,7 @@
Билай Станислав Романович; 2002-03-11; Мужчина; +79493761924; stasbilay02@yandex.ru;
Иванов Иван Иванович; 2002-03-11; Мужчина; +71111111111; dsjgbdskgb@yandex.ru;
Иванова Мария Сергеевна; 2002-04-05; Женжина; +382222222222; sdguhnlnoih@gmail.com;
Плешкова Анастасия Денисовна; 2006-11-10; Женжина; +73333333333; ple.anastasiya@gmail.com;
Зайцева Анжела Игоревна; 1998-12-12; Женжина; +74444444444; aksjfhfka@mail.ru;
Петров Петр Петрович; 1987-03-02; Мужчина; +77777777777; jksghhsdkj@gmail.com;
Зайцев Федор Александрович; 2014-12-22; Мужчина; +76667774441; asert@mail.ru;

2
composer.json Normal file
View File

@ -0,0 +1,2 @@
{
}

37
form.html Normal file
View File

@ -0,0 +1,37 @@
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<title>Form ФИО</title>
</head>
<body>
<form action="Information.php" target="_blank" method="post">
Фамилия: <br>
<input type = "text" name = "surname" required size="50" autofocus placeholder="Фамилия"> <br> <br>
Имя: <br>
<input type = "text" name = "name" required size="50" placeholder="Имя"> <br> <br>
Отчество (если есть): <br>
<input type = "text" name = "patronymic" size="50" placeholder="Отчество"> <br> <br>
Дата Рождения: <br>
<input type="date" name="DateOfBirth" required> <br> <br>
Ваш пол: <br>
<input type="radio" name="gender" value="Мужчина" checked> Мужчина
<input type="radio" name="gender" value="Женжина"> Женжина<br> <br>
Номер телефона (Например 1234567890): <br>
<select name="countryCode">
<option value="+7" >Russia +7</option>
<option value="+38">Ukraine +38</option>
</select>
<input type="tel" name="phoneNumber" pattern="[0-9]{10}" maxlength="10" required placeholder="1234567890"> <br> <br>
Email адрес: <br>
<input type="Email" name="email" required> <br><br>
<input type = "submit" value="Подтвердить">
<input type="reset">
</form>
</body>
</html>

16
functions.php Normal file
View File

@ -0,0 +1,16 @@
<?php
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
}
?>

6
index.php Normal file
View File

@ -0,0 +1,6 @@
<?php
//require_once "form.html";
//require_once "table.html";
require_once "table.php";
//require_once "functions.php";
//$size = 50;

48
table.html Normal file
View File

@ -0,0 +1,48 @@
<!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");
$buf = fgets($file, filesize("Information.txt"));
?>
<caption>Инфрмацмонная таблица</caption>
<table style="width: 100%">
<tr>
<th>ФИО</th>
<th>Дата Рождения</th>
<th>Пол</th>
<th>Номер Телефона</th>
<th>Email</th>
</tr>
<tr>
<
<td>Билай Станислав Романович</td>
<td>2002-03-11</td>
<td>Мужчина</td>
<td>+79493761924</td>
<td>stasbilay02@yandex.ru</td>
</tr>
<tr>
</tr>
</table>
</body>
</html>

54
table.php Normal file
View File

@ -0,0 +1,54 @@
<!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>