0

Web

my input data keeps on adding on database when i refresh my page. how to stop it? I already use header and locate it in the same page but error says that "redirected too many times".

4th May 2020, 9:31 AM
tres
3 ответов
+ 1
This happens because when you refresh the page the request is executed again and again. To stop this after it happens for the first time, create a Boolean variable "insert" and set it to true initially. Only perform the insertion to database if insert == true. Else, don't perform. You may set insert to false after first insertion.
4th May 2020, 11:31 AM
Amey Bhavsar
Amey Bhavsar - avatar
+ 1
Amey Bhavsar thank you, i'll try this
4th May 2020, 1:03 PM
tres
0
Remember to make the variable as a SESSION variable
4th May 2020, 1:26 PM
Amey Bhavsar
Amey Bhavsar - avatar