Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hitting refresh resends information to the page?

Status
Not open for further replies.

Webrookie

Programmer
May 18, 2000
112
US
How can I avoid this?<br><br>I have a user submit a form, data is processed and entered into database...if they hit refresh (56k modems, page appears to freeze) it prompts them that they must resend the information of click cancel.&nbsp;&nbsp;If they resend, that data is added into the database again...How can I avoid this?
 
Try a session variable to keep track of if the information has been saved. <br><br>You will need to check if it is the same user, maybe they have an user ID or other piece of information to track them.<br><br>Then you would use code similar to the following:<br><br>if session(&quot;Saved&quot;) &lt;&gt; &quot;Done&quot; and UserID= &quot;TheirUserID&quot; then<br>&nbsp;&nbsp;&nbsp;&nbsp;'this is where you would save the record.<br>&nbsp;&nbsp;&nbsp;&nbsp;session(&quot;Saved&quot;) = &quot;Done&quot;<br>else<br>&nbsp;&nbsp;&nbsp;&nbsp;'don't save the record again<br>end if<br><br>Hope this helps.<br>
 
&gt; if session(&quot;Saved&quot;) &lt;&gt; &quot;Done&quot; and UserID= &quot;TheirUserID&quot; then<br><br>Why do you need to check UserID when you are already using a session variable i.e., 'Saved' for verification?<br><br>-pete
 
You wouldn't really I guess. Just an extra check if needed. Thanks for pulling me up on that one Pete.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top