Jump to content

Form Submit Problem


jeeva

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/46541-form-submit-problem/
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/46541-form-submit-problem/#findComment-226642
Share on other sites

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

 

Link to comment
https://forums.phpfreaks.com/topic/46541-form-submit-problem/#findComment-226659
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.