Problem with POST transmission

In general, the whole point is this, there are three pages on which you save certain information.
They are transmitted through invisible fields, and on the third one they are stored in the database. But the problem is that when you entered a login that is already in the database, you need to ask the user to enter the login again, but when you direct him to another page, all data is lost.

Tell me how to make the login check normal?

Is it possible to somehow check on the fly if there is such a login in the database?


Answer 1, authority 100%

If you want everything to be beautiful, then use AJAX. Everything will happen on the fly and on the same page. More specifically, AJAXand jQuery. I myself once faced a similar problem and this solution was the most optimal in my opinion. In order to better understand, there is a book (reference book) with many examples (a similar one is also considered). Book “jQery”N.A. Prokhorenok.

I wish you success 🙂


Answer 2

Use session

$_SESSION['login']=$_POST['login'];

this will write the variable to the cookie provided by php. Read more here: session access functions.


Answer 3

it’s better not to store such information in cookies

And after checking the data, write an empty value to the cookie and time() -99999 and everything will be fine!

I.E. There is an operation that checks the data, so at the end of the operation, destroy the data that was stored in the kitchen for execution! No one steals cookies in a few minutes!

Well, to put it another way, if someone needs to commute something, then there are other more effective methods for this.