Logica:
first of all, what you want to do is done in javascript
or jquery
, the most correct way is by ajax
, in this case when you upload and process the file normally the php will have an answer of ok finish ... in that case what you can do is read the text file and print it with a echo
, as the request was made medium ajax
this will have a callback
or data return from the php, it is called response
good take the response and write it in a hidden textarea: <textarea name="hide" style="display:none;"></textarea>
game of this you do a javascript that with keydown s
navigate the textarea lines.
since there is no keydown on the php side, remember that php runs on the server side and the keydown event occurs on the client side. Greetings.
Requests:
working in this way will help you a lot since you only have to make a request by ajax the same where you upload the file does everything and the response is the result, this amounts to a single request.
then every time you press the 's' it will not make a request because the text is already in the textarea that you filled in the answer. and the route by line you can do with a function in jquey / javascript this does not generate requests to the server.
In this case I could not give you a code as an answer because you have not placed any progress of your code. When you have something more concrete I will check if I have time to give you a better answer. Greetings.