A little update: I’m quite proud that I figured out how to solve my problem completely on my own, without any knowledge of PHP. Here is what works (for anyone who might want to solve a similar problem in the future):
You first need to install a module, the
Submission Pre-Parser.
Create a new rule and select the form(s) where you want to work your redirect magic. All you need to do next is add one line of PHP code:
PHP Code:
$_POST["form_tools_redirect_url"] = "http://redirect-url/";
You need to replace "http://redirect-url/" on the right side with the URL you want to redirect to. "http://google.com" would, for example, redirect to Google after the form was submitted.
What I did was add a hidden input field to my (localized) form with the (localized) redirect URL as the value, like so:
Code:
<input type="hidden" name="redirect" value="http://redirect-url/" />
You again have to replace "http://redirect-url/" with the URL you want to redirect to.
To make this work you have to slightly change the PHP code of your Pre-Parser rule, like so:
PHP Code:
$_POST["form_tools_redirect_url"] = $_POST["redirect"];
$_POST["redirect"] grabs the value of your input field with the name "redirect" – the one I inserted before.
That already works, even if you forget to insert a hidden field. The user is then just redirected to the default Thanks! page. I’m not sure why that is the case (since I don’t know anything about PHP). I would think that you would have to add a check whether or not that hidden redirect form field exists, like so:
PHP Code:
if (!empty($_POST["redirect"]))
$_POST["form_tools_redirect_url"] = $_POST["redirect"];
That doesn’t break anything but it also doesn’t change anything. It would be nice if someone could tell me what I should use. I took a peek at process.php and it seems to me as though that same check is done there, too, so mine might be redundant. As I said before, I don’t know anything about PHP, I’m happy about all corrections.
Thanks, by the way, for this awesome tool which fits our bill so completely, it’s unbelievable. A incredibly well-thought-out tool!