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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Posting data multiple times

Status
Not open for further replies.

ifntech

Programmer
Nov 4, 2004
80
US
We have a interface that has if statements in it that look for and id variable. If the ID > "" then it give you an update form, else give you an insert form.

The issue has arose that if you stay in the current window after the record has been inserted and refresh it repost the data and duplicates the record, because I can't get the id to be passed in the querystring after the insert. So it gets the data after the insert but leaves the querystring id blank.
So it then repost the data again.

What variable could I use to grab the newly inserted record.


What I really want is to post the data and go to another page to add time. But when I redirect the page on the post it won't save the update.

This is the current form header.
<form method="post" action="trans_update.asp?t_id=" name="update_trans">

What I would like to do is post and go here.
<form method="post" action="time.asp?t_id=<% = t_id %>" name="update_trans">

Thanks in advance.
Dan
 
what I would suggest is that right after the insert you do a recordset sorted by id descending, and that's how you get your id.
 
typically a wise method for getting your record ID is one of the following:

recordset object, use the .update method, then return the ID.


use all the data inserted in a select where clause and retrieve the ID that way

use a secondary ID field and store the Session("SessionID") in the field and use that to retrieve the record ID, afterwards clear the secondary ID field to avoid future conflict. cant remember the context but there's also a digital ID that can be requested and used for this purpose something of the nature of GID, hopefully someone else could point this identifier out.

[thumbsup2]DreX
aKa - Robert
if all else fails, light it on fire and do the happy dance!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top