I'm doing some forms for a conference. They actually have 5 different ways you can register, each of which needs a different form -- a pre-conference, an individual registration, family registration, youth registration, etc. Most people who register will want to register some mixture of the above, like 1 individual, 1 family, 2 youth, etc. I'm wanting to collect data upfront to see what kind and how many of each form they need and then dynamically generate the forms they need in order -- like, for the above example, I'd first show them an individual form, then when they finish with that, I show them a family form, etc. I'm having trouble thinking through the logic of how to program that.
I started off with this (the 5 arguments are for each of the forms; the value of each is the number of that particular form that's needed):
function showForms($ind, $fam, $ya, $bs, $pre) {
if($ind != ""){
showIndForm();
}
}
function showIndForm() {
echo "<p>The individual form will go here.</p>";
}
All of that works, but that's when I realized that I needed help with the logic. Like, what if someone wants 2 ind forms, no fam forms, 1 ya form. Or maybe they want no ind forms but 2 bs forms. There are lots of possibilities and the way I had started out isn't going to cut it. Can someone get me started?