Forum Moderators: open

Message Too Old, No Replies

I want to know whether browser's back button is clicked or not?

After clicking browser's back button again data is getting inserted.

         

Rose

6:34 am on Jul 23, 2009 (gmt 0)

10+ Year Member



I am working in php. In my application user can post comment.once comment is posted, if user click on back button in the browser,same comment is again posted. Tried to unset the post array after insertation but not working as required. Is it possible to get the browser's back status in php or javascript to over come this problem?

janharders

6:49 am on Jul 23, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



the easiest thing to do is to add a check wether the insert was done already. doing it on the clientside with javascript is complicated because of different implementations in different browsers (that is, for example, opera does not honor no-cache-headers when using the back-button, while others do).

daveVk

6:57 am on Jul 23, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If submit done via get method, change it to post method.

Rose

7:02 am on Jul 23, 2009 (gmt 0)

10+ Year Member



submit is done via post method.

Rose

7:15 am on Jul 23, 2009 (gmt 0)

10+ Year Member



problem got solved by checking insert done already.Thanks to all.