FormClasses/info.php

56 lines
1.2 KiB
PHP
Raw Normal View History

2024-05-20 14:40:53 +03:00
<?php
2024-05-21 11:53:40 +03:00
namespace src;
use Information;
require_once "src/Information.php";
2024-05-27 11:40:02 +03:00
/*require_once "Search.php";*/
2024-05-20 15:11:17 +03:00
2024-05-21 17:06:42 +03:00
$fileName = "Information.txt";
$fileModeOpen = "a";
2024-05-20 15:11:17 +03:00
2024-05-21 17:06:42 +03:00
$fullInformation = new Information();
$fullInformation->load($_REQUEST);
2024-05-20 15:11:17 +03:00
2024-05-21 17:06:42 +03:00
echo "<pre>";
print_r($fullInformation);
$string = $fullInformation->toString();
2024-05-20 15:11:17 +03:00
2024-05-21 17:06:42 +03:00
$file = fopen($fileName, $fileModeOpen);
fwrite($file, $string);
2024-05-21 11:53:40 +03:00
fclose($file);
2024-05-21 17:06:42 +03:00
2024-05-27 11:40:02 +03:00
$formSearch =
'<form action="search_result.php" target="_blank" method="post">
<input type="search" name="result_search"> <br> <br>
<input type="submit" value="Поиск">
</form>';
echo $formSearch;
/*$file = fopen($fileName, "r");
2024-05-22 14:29:38 +03:00
2024-05-24 13:52:03 +03:00
$arrKey = array('surname', 'name', 'patronymic', 'dateOfBirth', 'gender', 'countryCode', 'phoneNumber', 'email');
$parsingArray = array();
2024-05-24 13:04:27 +03:00
2024-05-27 11:40:02 +03:00
echo "<pre>";
print_r($_REQUEST);
$forSearch = $_REQUEST['result_search'];
2024-05-24 13:04:27 +03:00
while (!feof($file)) {
$str = fgets($file);
2024-05-27 11:40:02 +03:00
//if(search($str, '/\b(иванов)\b/ui')){
if(search($str, $forSearch)){
2024-05-24 13:52:03 +03:00
$array = array_combine($arrKey, explode(";", $str));
$obj = new Information();
$obj->load($array);
$parsingArray[] = $obj;
2024-05-24 13:04:27 +03:00
}
}
echo "<pre>";
2024-05-27 11:40:02 +03:00
print_r($parsingArray);*/
2024-05-22 14:29:38 +03:00
2024-05-21 11:53:40 +03:00
require "table.php";