I've completed a form (albeit not very well) and am currently trying to work out a 'confirmation' page in php that displays what the user will print after it's filled out and submitted. I've declared all the variables in php for every input field on the form - however, I have a section of the form that dynamically replicates and increments it's class numbers in jQuery. For reference:
$('#replicate').click(function(){
var $cloned = $('.container').clone();
$cloned.find('input').val('');
$cloned.appendTo($('.emptyContainer'));
var container = $(".emptyContainer div").length;
var containerNumber = container + 1;
var containerClass = 'container' + containerNumber;
$(".emptyContainer .container1").attr("class", containerClass);
So what the above does is that when the user hits the replicate button the container with all the input fields, well, replicates - and the new container that appears has a class number of '.container2', '.container3', etc. for as many times as the user needs. The input ids and names within each new container also increment accordingly. I've gone about declaring all the php variables for the first container - so if the first input id is "firstname1" the php variable is $firstname1 on my confirmation page.
What I'm trying to figure out, is how do I go about echoing out each new input on the confirmation page when "#firstname2", "#firstname3", get generated? Would that be something like a for loop? Excuse my ignorance, never done much in php.