Answer the question
In order to leave comments, you need to log in
How to pass a variable to another file?
There are 2 files. 1: main page 2: the page that executes the script. The main page is only responsible for formatting the data output without reloading the page. On the second page, all manipulations take place: the script takes data from the database and displays them. I want to make an output filter from the database, for example, display numbers from 1 to 3 + category checkboxes (On the main page). As far as I understand, I need to pass the variable from and to to my second file, and then write the condition in sql. But I don’t understand how to transfer variables to this second file, I don’t want to make a form with a submit button, since there shouldn’t be page reloads at all ... I read about sessions, I don’t quite understand how to accept a variable from the user and write it to the session. It would not be bad if you could tell me which way to look :) Thank you
Answer the question
In order to leave comments, you need to log in
A question with a bunch of contrived restrictions.
1. Read about MVC. And the code will become clearer and more readable, and there will be no page references.
2. If you want without reloads - you need to write a js code that, when the form changes, will send an ajax request and render it to the page accordingly.
api.jquery.com/jquery.ajax at the very end examples
I don't want to do a form with a submit button,
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question