Oops! Sorry, I missed your post.
Sure! Since you're using the API, you can tell it to redirect to any page you want. Basically, it would work by dynamically constructing the $params to pass to the ft_api_process_form() function.
Here's an example. Pretend the API code at the top of your form page looks like this: (this is the page that you want to redirect to two different locations, depending on the user input)
PHP Code:
<?php
require_once("path/to/form_tools/global/api/api.php");
$fields = ft_api_init_form_page("", "test");
$params = array(
"submit_button" => "submit_button",
"next_page" => "next_page.php",
"form_data" => $_POST
);
ft_api_process_form($params);
?>
So whenever the form on that page is submitted, it will
always redirect to next_page.php. What we want to do is choose the location
based on (say) whichever submit button is pressed.
So add the following buttons to your form:
Code:
<input type="submit" name="submit_button" value="Submit! (1)" />
<input type="submit" name="submit_button2" value="Submit! (2)" />
[Note on usability: if the user clicks "enter" on any form field, on many browsers it will pick the FIRST submit button in your form and submit that. So order them in a way that's most logical].
Now, doctor the PHP to figure out which submit button was pressed. If memory serves, it only sends the name-value pair of the submit button that was pressed - not all buttons. So, your PHP could use this info like so:
PHP Code:
<?php
require_once("path/to/form_tools/global/api/api.php");
$fields = ft_api_init_form_page("", "test");
$params = array(
"submit_button" => "submit_button",
"next_page" => "next_page.php",
"form_data" => $_POST
);
// if the user clicked the second button, redirect to a different page
if (isset($_POST["submit_button2"]))
$params["next_page"] = "a_different_page.php";
ft_api_process_form($params);
?>
And that's it! If the user clicks the second submit button ("Submit! (2)") they will be redirected to
a_different_page.php. Otherwise they get sent to the default ("next_page.php").
I admit, I haven't tested this, but I'm pretty sure it would work fine.
Let me know if you have any trouble or if I didn't explain it very well!
- Ben