Okay so it’s only getting one value. We can put the PHP and Database stuff to the side for now. The problem is definitively somewhere in the frontend.

Image

i have three mysql table iap3, iap4 and iap5. Iap3 is parents where as iap4 and iap 5 both child table with multiple records against one parents record. I have one php form as shown below. the problem which i am facing is that I generated last insert id from parent table (iap3) and want to insert it against every record in child table in both table (iap4 and iap5). but the problem which I am getting is that it successfully entered last id for both child (Iap4 and Iap5) and also show all child entries of iap4 table but its only stored first record in iap5 table rather than all the entered one (i needed last insert id to interlink parent table with child one )

Image

Does $scode1 actually contain all of the data its supposed to? If not, you’ve got a front end issue. var_dump($scode1) and take a look at it.

Possibly. I’m not sure why the IAP4 code actually works; You should be required to wrap the variables in curly braces to make PHP process it correctly.

when i had only two table iap3 and iap4, its worked fine, but when i added third table it start creating issue. ok let me send u complete code for both front end and back end : front end :

i thnk there is problem in java script code where i am cloning dynamically created new rows. can you check both add button code for new rows in front end (iap4 and iap5 )

Thing is, when i take your (partially fixed) code, stick it into Codepen, (and tell Codepen to load jQuery, and to remove the autocomplete), the form works as expected for me…

its for different purposes, i deleted iap4 table and guess what, it still showing just one row in iap 5. now there are only two table but still its not solving the issue. tel me one thing can i use one java script function to deynamically create rows for both iap4 and iap5 ?

Doesnt really matter. All this is doing is pointing you at where the problem lies; if the variable contains many entries, and your code is only inserting one, your problem is either in PHP or the database. If it only contains one entry, your frontend is the problem, because PHP isnt receiving all of the data.

Image