|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
Passing value from one form to another form
i have a registration form where the student must enter their personal info(will be inserted in a personal_info table)then the student have 2 proceed and fill up the next form by entering what subjects he would like 2 take....now the problem is i dont know how to retrieve the identity number that has been entered in the previous form(personal info) to be inserted in the subject table...plz help...
|
|
#2
|
|||
|
|||
|
sure you do, how are you having the user select the primary key? Is it automatically assigned? are you using their name? Whatever you set the value to be you just say request.form("name of input") or request.querystring("name of input") depending if you do a POST or GET respectively.
if you're doing an autoincrementing number, well, i've never thought of a better way then quering the database with the request.form(variables) and getting from the previous page, and the most recent row (should only be one if it's truly a primary key....) is your user entered data. If anyone else can think of a way for autoincrementing numbers i'd like to hear it... |
|
#3
|
|||
|
|||
|
My understanding is that ther user fills in FORM#1
Then you make an INSERT into a TABLE. What you need is the UNIQUEID of the record you've just INSERTED right? Then as you're sending the user to fill in FORM#2 you need to pass that UNIQUEID that you've just received. To do that, you'll want to look into @@IDENTITY and there is another one which I forgot that's better then @@IDENTITY but...anyway read this: http://www.aspfaqs.com/aspfaqs/ShowFAQ.asp?FAQID=79 Hope this helps! Sincerely Vlince |
|
#4
|
|||
|
|||
|
the identity number which i meant here is the user's identity card number.....
|
|
#5
|
|||
|
|||
|
How bout this
sure you must have used this method
<% Dim strCardID strCardID = Request.Form("txtCardID") %> Then on the other page you can retrieve the CardID like this <input name="txtCardID2" type="text" value="<%=strCardID%>"> Hope it helps ![]() |
|
#6
|
|||
|
|||
|
thanks a lot......
|
|
#7
|
|||
|
|||
|
Quote:
If you need help, this is a terrible way to get it. You need to give us more information now, once again, are you letting the user pick the number or is it an autoincrementing number or being assigned by some other method? if you are letting the user pick the value you can do what i said earlier, or what darontan was so nice as to reiterate. If not, how did you insert the last record was it an autoincrementing column? random generator? can you uniquely identify this column? Vlince's method is fantastic if you can lock the database, however this is a terrible solution if you can't for obvious reasons a way around this is if you can uniquely identify this column with given information (and i hope you should), then you should do another query to select that row. Are you grabbing name and address? I don't think people with the same name and address enter a query within 10 milliseconds of each other? What's the level of security and data integrity of this site? "also darontan's method" only works with a POST method, you'll need request.querystring if you're doing a GET. Also are you doing this in VBscript? If you need Javascript send out another message. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > Passing value from one form to another form |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|