Answer the question
In order to leave comments, you need to log in
How to output a specific line from a file to an html page with a search form?
There is an html page with a search form, a file with 1500 thousand lines.
How to make it so that when you enter in the search form, a specific found string is displayed, and not the entire list. Without using MySql, limited to html, php
Answer the question
In order to leave comments, you need to log in
What you want is not solved by regular expressions in principle.
This requires intelligence.
Why PHP?
Isn't js + json easier?
You send an ajax request to a file and get a response.
Here is the first thing that came up in the search - autocomplete js json
https://codepen.io/massimo-cassandro/pen/NqRmMe?q=...
Anyway, there are a lot of https://codepen.io/search/pens?q =autocomplete&limit...
1. Line by line pass through the file - ,
2. Check for occurrence of a substring in a line - .
3. If it is included, then output a string. If it is not included, we do not withdraw. explode("\r\n", $file)
foreach()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question