close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues


Insert page, 2 tables & 1 'stages' form.

Thread began 1/26/2012 5:39 am by gary.brett434358 | Last modified 1/28/2012 3:05 am by gary.brett434358 | 1190 views | 10 replies |


Insert page, 2 tables & 1 'stages' form.

Good morning, this may sound confusing so please bear with me!

I want users to add sales leads to our database, currently have tblCases & tblContacts which holds this information. On the Cases insert page I can pull the contact through to assign to case by using dynamic dropdown but I want to make this more user friendly.

I have a wizard style form, each step is a simply div with 'Next', 'Previous' & 'Finish' buttons.

Step1 - tblContacts.php
Step2 - tblCases.php
Step3 - Insert/Finish

Step1 a tblCase.CaseID would be created, I would like the users to either select a current contact or be able to add a new contact to case. If current that contacts data should be auto filled onto form, ie address, phone etc.

NEXT button -->

Step2 the form will contain data to be inserted into tblcases along with ContactID from above.

INSERT / FINISH button -->

Can I join the 2 tables above to allow data to be inserted into both, if so would I be able to split 1 form that collects this data into 2 parts [Contact + Case Data]?

Is it possible to have the ContactID details auto inserted into form fields when a contact is selected from Dynamic menu?

Many thanks once more.

Sign in to reply to this post

Ian S

Hi Gary,

You can't join a table for the purpose of an Insert. What you would need to do is create two insert behaviours on the page, one for each table.

Assuming that each client have have more than one case, if you inserted the Client first you can store the ID of that client in a SESSION variable which can then be used for the second insert behaviour for the case, to link the two together.


Sign in to reply to this post

Jason ByrnesWebAssist

to expand on what Ian is saying slightly:

In the DataAssist Insert Record behavior, there is a section titled Session variable. In the first insert record, insert the client data, select the ClientID as the Key Column in the Session Variable section and make note of the name in the Store As setting.

when the Client information is stored, it will store the ID of the record that is created.

in the second insert record behavior, it will insert to the cases table. Bind the casesClientID column to the session variable created by the first insert behavior.

Sign in to reply to this post


Evening gents, each case will have 1 client & 1 'salesperson', the salesperson can have many clients and many cases.

I have run the DA wizard on the tblCases first then was going to go DA > Insert > Insert Single Record based on the tblContacts. You suggested doing this with tblContacts as first insert, does that make a difference?

Would I need to add the required form fields manually before creating the 2nd insert record as I cant seem to add the fields I want from tblContacts? Only option I get for field value is the pages form fields, which currently don't have any fields from the tblContacts? I need to add fullname, contactid, staffid fields from tblContacts?

Sorry to keep asking, I am sure once I understand the process I will be fine and can use the example throughout my project.


Sign in to reply to this post

Jason ByrnesWebAssist

well, the client needs to be inserted first.

you cant relate a case to client unless the client record already exists.

yes, you need to manually add the additional form fields to the insert page.

Sign in to reply to this post


Good morning, OK managed to start this now.

1 - Run DA wizard to create tblContacts - ContactID | ContactName | ContactDate | ContactAssignedTo

2 - Open tblConactsinsert.php in DW, add manual fields for input data to tblCases - CaseID | ContactID | CaseType | CaseDate | CaseStatus

3 - Server Behaviours Panel - Data Assist | Insert | Insert Single Record

4 - Select tblCases, Key Column 'CaseID', complete table field values by selecting the manual fields I just created on the form, example [<?php echo ((isset($_POST["CaseType"]))?$_POST["CaseType"]:""); ?>]

5 - Open 'insert record [tblContact]', key column is 'ContactID' & Store As 'WADA_Insert_tblcontacts'

6 - Open 'insert record [tblCases]', key column is 'CaseID' & Store AS 'tblcases_CaseID', go to ContactID from tblcases and set value as 'WADA_Insert_tblcontacts'

The records get inserted on both tables which is great but on the tblCases side there is no ContactID leaving the cases unassigned to anyone. I am guessing the binding is in the wrong place but cannot fathom where it should go?

Worth noting that the 'ContactAssignedTo' field from tblContacts is the field that will link to the case? I need the ID that is selected from that field to also insert into ContactID field of tblCases.

For example, if user selected 'John Smith' from the menu on 'ContactAssignedTo' this would insert ContactID 100 into both tblContacts.ContactAssignedTo & tblCases.ContactID

Sorry for all questions, I think I am nearly there!


Sign in to reply to this post


Page attached..

Attached Files
Sign in to reply to this post


So the Session set by DA is used in later inserts.... HHHmmnnnn I always wondered why you guys created the session var. I've always used the PHP function that takes the primary key from the initial insert:

<?php $record_id = mysql_insert_id(); ?>
Sign in to reply to this post


Originally Said By: Steve272190
  So the Session set by DA is used in later inserts.... HHHmmnnnn I always wondered why you guys created the session var. I've always used the PHP function that takes the primary key from the initial insert:

<?php $record_id = mysql_insert_id(); ?>

Sorry, not sure I understood that, was it posted for me?


Sign in to reply to this post

Jason ByrnesWebAssist

I have created a support ticket so we can look into this issue further.

To view and edit your support ticket, please log into your support history:

If anyone else is experiencing this same issue, please append to this thread.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question





Ease of use


security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...