Answer the question
In order to leave comments, you need to log in
How to deal with sessions and arrays in php?
Please do not throw slippers at me .. and explain in an accessible way.
I am a student and I am learning to program in a place where they don’t teach me this, so there are gaps in knowledge.
Can you please tell me how to do it so that the index of the value in the array is recorded in the session? Well, or something like that.
Declaration
Output
Now, when the session is output, the last element is displayed.$nf = $_SESSION['number_flight'];
echo $nf;
Answer the question
In order to leave comments, you need to log in
Break the task into subtasks and it will become easier for you to figure out how to solve each of them.
For example instead of:
Set tasks like this:
All items "learn", "understand", "understand" by and large will need to be done once for each atypical task. But if, instead of a complex perception of "do it well", you start to understand what is behind the technology on which you are trying to develop - you will start to really learn.
And questions like "how do I do this exactly" - they just teach you to repeat the code after people from Toster or StackOverflow without understanding what they are doing.
So understand how the web works in general: what is HTML and what is executed in the browser, what is PHP and what is executed on the server, how the browser sends data to the server, etc., etc.
As a result, you should fully understand how your page works and the paths through which data is transmitted from the moment the page is generated until the moment when you process the form received from the user and give him a success or error message.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question