of course your can set up more adressfields right into insert in the “new” form. its just more data to handle.
thats what my boyfriend allways tells me
on after insert.
i dont get this question very much.
the idea is: you set up the form based upon a table, “company-base”. than you add some new fields, lets say {data1} is a field for sql table “stations”, {data2} is a field for table “adresses” .
before you insert the new data into the database (in this moment, before inserting, you dont know the ID of this data, which is given by sql i guess when inserting, ID must be a AI field, isnt it?) - so: before you insert that new data, you “save” something to remember this dataset. this must be a unique field, for example {companyname}.
after inserting ( -> on after insert ) you get the ID from the sql which is just executed. to do this, you use your unique field help variable, companyname.
must be something like select ID from company_detail where companyname is companyname.
than - this is 6 and 7 - you go on with the code right there, inside “on after insert” - you do a second sql statement: insert into stations
the fields {data1} and {data2} are still there. so you say
insert into stations ((id=> $id) , (sql-data => {data1} ) );
the fields are still there and there is no need to use more variables.
step 7: same procedere.
insert into companyadresses ((id=> $id) , (sql-data => {data1} ) );
remember to unset, because if you dont you could struggle when you insert a second new company.