Separate Entries in form A for Each Repeater Field Entry in form B

By: lauren scott | Asked: 02/07/2024
ForumsCategory: Code SnippetsSeparate Entries in form A for Each Repeater Field Entry in form B
lauren scott asked 6 months ago

There are similar questions answered however I am trying to do something a little different than what I can find.

I want to submit form B with a repeater field,  and for each row in the repeater, I want to create an entry in form A, passing some of the values from each repeater row, to a new entry in form B.  

I can't seem to find a way to do this, so I attempted to create a function to do this after form B is submitted.  So, the code seems to work, but for some reason I am getting three entries in form A for each row in form B.

 Also, I get one good entry using the values, but I also get two blank entries.   any ideas.would be greatly appriciated.  


Here is my code 



2 Answers
Victor Font answered 5 months ago
There's no solution for this unless someone does some hands-on debugging. You have to see the values of $_POST['item_meta'][602] in order to make sure the loop is doing what it is supposed to do. Have you ever used the Kint debugger. You need a tool like this to determine why you are getting three entries.
lauren scott answered 5 months ago
Ill give it a try.  thanks for your time.  it is appriciated.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community