Duplicate form field answers in...

User 264425 Photo


Registered User
32 posts

Hi. I'm going to create a form that parents will complete as they register their child/children for an event. The form will have fields for the parents' name, phone, etc. and more fields for their child's name, age, etc. The results will go into an SQL database so I can download as a csv. I need one form submission per child so that every child who is registered will have the proper parent info associated with their name.

If the parent has two children, they'll need to complete the form twice. If they have six kids, they need to complete the form six times. (You see where I'm going with this.)

Is there any way to keep the parent from having to resubmit the same information -- parent's name, phone, etc. -- multiple times as they register their various children?

I know I can add multiple fields for multiple children to the same form, but as I indicated, my database has to have a separate listing/row for each child and their parent.

At this point I'm planning on just having them complete the form for the first child, complete it again for the second, etc., but thought I would ask here first in case there's a shortcut I don't know about. Any ideas appreciated. Thanks.

Dave
User 187934 Photo


Senior Advisor
18,728 posts

Hi Dave,
Yes this can be done. The easiest way is to use the Custom Redirect option and grab the $_SESSION variables that the form builder uses and populate the form with them. Another way is to use an Ajax request and set the $_SESSION variables that way.
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

Here's my S-Drive site with
examples of what can be accomplished in VSD.
https://progrower.coffeecup.com/
Here's my CoffeeCup SCCP Shop with examples of what can be done.
https://progrower.coffeecup.com/shop/
This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 264425 Photo


Registered User
32 posts

Hi Eric,
I am greatly encouraged by your answer, thank you. However, I would appreciate some guidance here.

Should I assume the Custom Redirect to which you refer is found in SETTINGS on the CONFIRM PAGE tab? Would I redirect to another URL or to a custom HTML page?

I am starting to understand that I can use the "Insert data from" drop down to insert form answers into another page (or form), but how would I get those answers into the (next) version of the same form (for the next child to be registered)? Would I need TWO duplicate forms, the original form and another that has the copied form results for the given parent?

And would my form have TWO buttons, one that reads "To register another child, click here" and another that reads, "All finished, submit"?

Again, any help appreciated. Thanks again.

Dave
User 187934 Photo


Senior Advisor
18,728 posts

There again a few ways to handle this. I guess I would make your own custom confirmation page that captures the $_SESSION variables. You can have a button or link on the confirmation page to let users register another child.
So to get started you would have your confirmation and in that you catch the variables like this. You'll need to either enable php parsing within html on your host with .htaccess or change your forms extension to php and make the adjustment to anything linking to it.
<?php
session_start();
$post = $_SESSION['post']; // This is getting the post array
$_SESSION['firstname'] = $post['firstname'];
$_SESSION['lastname'] = $post['lastname'];
?>

You can echo the variables to fill the confirmation
echo $post['firstname'];
echo $post['lastname'];


Add a link or button to your confirmation for users requesting another registration


At the bottom of your formname.html unset the variables.
unset($_SESSION['firstname']);
$_SESSION['lastname']);


Within the myformname.html you prefill inputs using the session variables when users click the button.
value="<php echo $_SESSION['firstname'];?>"


This is a short version of the basic needs and doesn't address ever scenario possible but I think it's enough to get you started.
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

Here's my S-Drive site with
examples of what can be accomplished in VSD.
https://progrower.coffeecup.com/
Here's my CoffeeCup SCCP Shop with examples of what can be done.
https://progrower.coffeecup.com/shop/
This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.