koolkat67 Posted March 25, 2007 Share Posted March 25, 2007 I have a comments page on my site where it consists of the form on top and the results below. when the users hits submit, the page reloads, the values get entered into the database and the results are shown below. however, when the user hits refresh after all that, their same entry is added again to the database. What is the way to resolve this? Link to comment https://forums.phpfreaks.com/topic/44259-refresh-keeps-subimtting-variables-into-sql/ Share on other sites More sharing options...
Trium918 Posted March 25, 2007 Share Posted March 25, 2007 It would be nice if you would provide the code because I am have the same problem. Maybe we can work together with the help of others with this one. Link to comment https://forums.phpfreaks.com/topic/44259-refresh-keeps-subimtting-variables-into-sql/#findComment-214971 Share on other sites More sharing options...
Waldir Posted March 25, 2007 Share Posted March 25, 2007 after you have entered the information into the database do header("Location: page.php"); Link to comment https://forums.phpfreaks.com/topic/44259-refresh-keeps-subimtting-variables-into-sql/#findComment-214973 Share on other sites More sharing options...
koolkat67 Posted March 25, 2007 Author Share Posted March 25, 2007 omg! that totally worked. ive been fighting this forever now. this should help Trium918 there too. thanx! Link to comment https://forums.phpfreaks.com/topic/44259-refresh-keeps-subimtting-variables-into-sql/#findComment-214977 Share on other sites More sharing options...
Waldir Posted March 25, 2007 Share Posted March 25, 2007 no problem, mark as solved Link to comment https://forums.phpfreaks.com/topic/44259-refresh-keeps-subimtting-variables-into-sql/#findComment-214981 Share on other sites More sharing options...
Trium918 Posted March 25, 2007 Share Posted March 25, 2007 Are you redirect back the the same page are what. Link to comment https://forums.phpfreaks.com/topic/44259-refresh-keeps-subimtting-variables-into-sql/#findComment-214983 Share on other sites More sharing options...
koolkat67 Posted March 25, 2007 Author Share Posted March 25, 2007 yeah i used the location comment and redirected back to the same page Link to comment https://forums.phpfreaks.com/topic/44259-refresh-keeps-subimtting-variables-into-sql/#findComment-214984 Share on other sites More sharing options...
Waldir Posted March 25, 2007 Share Posted March 25, 2007 yeah u redirect to the same page you ame from however, the var $_POST is no longer alife, wich means hitting refresh wont repost information Link to comment https://forums.phpfreaks.com/topic/44259-refresh-keeps-subimtting-variables-into-sql/#findComment-214985 Share on other sites More sharing options...
Trium918 Posted March 25, 2007 Share Posted March 25, 2007 Did you use it in a if statement or what? Link to comment https://forums.phpfreaks.com/topic/44259-refresh-keeps-subimtting-variables-into-sql/#findComment-214988 Share on other sites More sharing options...
Waldir Posted March 25, 2007 Share Posted March 25, 2007 use it liek this: INSERT into bla bla bla; header("Location: page.php"); Link to comment https://forums.phpfreaks.com/topic/44259-refresh-keeps-subimtting-variables-into-sql/#findComment-214989 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.