I do not know english very much. Some words and phrases I might have mistyped.
txt my data:
ID: 12345
Name: Cem
Surname: Mehmet
Age: 19
ID: 22222
Name: Yasar
Surname: Gormez
Age: 25
There's plenty of my data in a sequential manner as the above.
ID 12345, which gives name to find this data, I took the surname and age variable information.
Moreover, the data ID 12345 Name, Surname, and I want to change the information age.
<html>
<head>
<meta charset="utf-8" />
<title>search</title>
</head>
<body>
<form method="POST">
<input type="text" name="q" id="q"></input>
<button type="sumbit">ok</button>
</form>
<?php if($_POST){
$file = 'search.txt';
$find = $_POST['q'];
$contents = file_get_contents($file);
$pattern = preg_quote($find, '/');
$pattern = "/^.*$pattern.*\$/m";
if(preg_match_all($pattern, $contents, $matches)){
echo implode("\n", $matches[0]);
}
else{
echo "error";
}} ?>
</body>
</html>
Aucun commentaire:
Enregistrer un commentaire