Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

multi step form with 3 tables

New Here ,
Aug 04, 2006 Aug 04, 2006
Hi:
I have a database with 3 tables. Table 1 has one-to-many relationship with two others. Infact in table 1 user should enter his basic info and details will be submited itno two other tables.
Is there any easy way to make it with colfusion?
I know that session may help but it is needed that each page can submit information (if the user doesn't fill the last form them I may loose data with session)
I thought of sending information to other page with form action="page.cfm" but my problem is I don't know how to submit information in the second form that the primary key of table one becoms the foreign key of the next page. Please please I really need this. I really need it. Is there any tutorial or easy way for it that I can make it fast. As I said it is an emeregncy for me.
Thanks
Benign
601
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 05, 2006 Aug 05, 2006
Why don't you put the 3 insert queries on the same page?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Aug 07, 2006 Aug 07, 2006
I think i understand what your asking, but I need to know what Database you are using? If you are using MSSQL, you can select @@identity, which will be the primary key for the last item inserted in the db. If you have a different db, let me know and Ill tell you how to do it.
Mike
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 07, 2006 Aug 07, 2006
Hi:
For now I use MS Access (to make things easier) so please let me know how I can make such registration wizard.
thanks a lot
Benign
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 08, 2006 Aug 08, 2006
Hi:
For the present application I use MS Access (to make things easier). It will be very great if you let me know how I can make such registration wizard.
Thanks
Benign
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Aug 08, 2006 Aug 08, 2006
What you do is make your first insert, then right after that, you do a select like the following to get the value of the PK you just inserted:
SELECT MAX(PK) AS pk1
FROM tblABC
WHERE firstfield(db)=firstfield(form), secondfield(db)=secondfield(form), etc for ALL or most fields you insert previously.

pk1 will now be the Primary Key value of the line you just inserted. You can keep that in a variable via hidden input, or in the url for when you go to the next page, and repeat the process.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 08, 2006 Aug 08, 2006
Hi:
Thanks a lot for the reply.
I think I got what you suggested. But as I am a novice in programming can you please give me an example code somewhere in the internet?
I searched for it everywhere but no way!!!
Thanks again.
Benign
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Aug 10, 2006 Aug 10, 2006
LATEST
Well the example I posted is the only time ive had to do it, and all I changed were variable names. Why dont you use that example to give it a try, and if it doesnt work, then post your nonworking code here, and Ill help you sort out the problem...The more code you post, with more specific information, the better we can help you.
-Mike
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources