FORUMS


The Form Tools forums are no longer active, but the old posts have been archived here. Please see the Help page on how to get help / report issues.

Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
multi page dependency
#1
I would like to add a multi page form whereby the second page depends on the input of the first page.

For example on the first page I have a drop-down with "A" and "B".
If "A" is selected it will continue with form A and if "B" is selectected it will continue with form B which is different from form A.

How must the code look like?

Thanks in advance and best regards, Hannes.
Reply
#2
Hi Hannes,

Sure, this can be done like this. At the top of your form, you should have something like this already there:

PHP Code:
$params = array(
  ...
  
"next_page" => "form_A.php",
  ... 
  );
ft_api_process_form($params); 

The "next_page" key lets the ft_api_process_form function know where to redirect the user to next.

What you need to do is just construct the $params variable to have a different redirect page, depending on what was entered in the form. So something like this would work:

PHP Code:
if ($_POST["dropdown"] == "A")
{
  
$params = array(
    ... 
    
"next_page" => "form_A.php",
    ...
      );
}
else if (
$_POST["dropdown"] == "B")
{
  
$params = array(
    ... 
    
"next_page" => "form_B.php",
    ... 
      );


I've omitted all the stuff that'll be specific to your form, but that's the general idea.

Hope this helps!

- Ben
Reply
#3
works like a charm...
Thank you a lot for the detailed instructions!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)