Home › Forums › General Issues › Populate Gravity form fields with ACF subfield values based on dropdown select › Reply To: Populate Gravity form fields with ACF subfield values based on dropdown select
Your second code will always loop though all the rows and set the $_POST value each time, always ending with the value set to the final row of the repeater. You need to somehow match them and that will only be possible if the start date value is unique.
while (have_rows('course_info', $courseid) {
the_row();
if (get_sub_field('startdate') == $submitted_start_date) {
$_POST['input_40'] = get_sub_field('location');
}
}
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.