表格中的Foreach循环

I'm using wordpress to create a website and I need to create a form that allows users to select a number from a dropdown list and then populate the form with that amount of data

Since I'm new with wordpress I'm using the Caldera Forms plugin to build the forms but there's no repeater or something similar to use

I'm not any good with php to create a script for this and can't find any other solution online

IF I Select 3 from the dropdown the following needs to display on the form


Sample 1 Date:[Current Date]
Code:[text]
Flock:[text]
Species:[text]
Age (days):[text]
House:[text]
Analysis Required:[text]

SAMPLE 2

Sample 2 Date:[Current Date]
Code:[text]
Flock:[text]
Species:[text]
Age (days):[text]
House:[text]
Analysis Required)[text]

SAMPLE 3

Sample 3 Date:[Current Date]
Code:[text]
Flock:[text]
Species:[text]
Age (days):[text]
House:[text]
Analysis Required:[text]```

edit: Caldera forms has a Conditional tab that allows you to add if statements 

So, if you decide to do without plugin, this is part for front end, to add remove and submit samples https://jsfiddle.net/Beneris/ns7dq9Lz/39/

You still need to add ajax_url to footer.php

<script>var ajax_url = "<?php echo admin_url( 'admin-ajax.php' ); ?>";</script>

And function to process submitted data, to functions.php

add_action( 'wp_ajax_save_samples', 'ajax_save_samples' );
add_action( 'wp_ajax_nopriv_save_samples', 'ajax_save_samples' );

function ajax_save_samples() {
    $json= strip_tags($_POST['json']);
    $data = json_decode($json);
    foreach ($data as $d) {}
    exit;
}