jeeva Posted April 11, 2007 Share Posted April 11, 2007 hi frnds, i have one form where the user enter and submit the data through text box.its working fine but if the user refresh the page, the same data will be submit. Its should not happen while refresh. the page should open like new. But i solved this problem by redirecting the page, but i need without redirect page . can i do like that? jeeva Quote Link to comment Share on other sites More sharing options...
PC Nerd Posted April 11, 2007 Share Posted April 11, 2007 well just go in the fields value = "" within the tages theres more complicated ways, but thatll do it Quote Link to comment Share on other sites More sharing options...
jeeva Posted April 11, 2007 Author Share Posted April 11, 2007 i tried that also but its not woking it should not work also because it submiting the old data not new one so its not a solution for this i think... Quote Link to comment Share on other sites More sharing options...
PC Nerd Posted April 11, 2007 Share Posted April 11, 2007 well look up in google: "HTML, text field" therell be a link to a w3c and therell be a list of attributes you can set. goo dluck else you could use javascript, but php is the hardest and least easy in this case ithink Quote Link to comment Share on other sites More sharing options...
rcorlew Posted April 11, 2007 Share Posted April 11, 2007 After you use a vriable and before you prepare it for reuse you should use "uset($var);" to clean the old value then you can reset the new value and post again. Quote Link to comment Share on other sites More sharing options...
PC Nerd Posted April 11, 2007 Share Posted April 11, 2007 yeah but arent they going back ,then refreshing, therefore the browser is storing teh value, and not the server? Quote Link to comment Share on other sites More sharing options...
rcorlew Posted April 11, 2007 Share Posted April 11, 2007 If they keep hitting refresh the browser has the $var, if they are trying to post again and getting old $var the server has the $var. I have not heard of a way of remving a variable on the browser without it being a cookie. Quote Link to comment Share on other sites More sharing options...
jeeva Posted April 11, 2007 Author Share Posted April 11, 2007 i tried with unset also no use...its keep storing the data... Quote Link to comment Share on other sites More sharing options...
ryeman98 Posted April 11, 2007 Share Posted April 11, 2007 I'm not sure I completely understand...where will the data be stored? Quote Link to comment Share on other sites More sharing options...
PC Nerd Posted April 11, 2007 Share Posted April 11, 2007 can you post the code please Quote Link to comment Share on other sites More sharing options...
rpadilla Posted April 11, 2007 Share Posted April 11, 2007 hi, the trick here is to redirect back again, so that when the user refreshes the page it won't re submit the data so in the end of the submission process of the data do something like this header("location: whereyouwanthimback.php"); in this way refreshing, won't make a resubmit of data. cheers Quote Link to comment Share on other sites More sharing options...
sunilvadranapu Posted April 11, 2007 Share Posted April 11, 2007 Hi, I hope you are checking whether submit button was clicked or not begore going to insert the data into the database. If you are doing like that you change the button name after you insert the data. that will solve the problem ex: if(strcmp($submit,"Submit") ==0){ code for inserting data if success , rename the value of $subit to some othere .. $submit=""; } i hope it is helpful to you -SunilKumar Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.