Tuesday, September 5, 2017

Adding rules and conditional redirection to forms

I am using 123Forms as my form system.
Unfortunately it is not possible to use external payment system.

I have devised a system to use the form data to redirect to a certain payment page.

Here is how to do it:
First create a new form with fields (I am using WIX and 123forms wysiwyg editor).
and publish it.
Using Google Chrome Developer tools (ctrl-shift-i) or other browser and find out the required field identifier
it looks something like this:


(Thanks to 123forms excellent support)

(An even better explanation)

 Then you need to create script that can read this data and host it.

I use FreeHostingEU to host my script and NameCheap for a domain register.

In FreeHostingEU I put the following file, hello.php:

<?php
$adults = $_GET['adults'];
if ($adults==1){
header("Location: https://link1...");
die();
}
if ($adults==2){
header("Location: https://link2...");
die();
}
if ($adults==3){
header("Location: https://link3...");
die();
}
else{
header("Location: https://link4...");
die();
}
?>
<html>
<head></head>
</html>

Return to the form editor and go to Settings -> Thank you page and select Redirect with custom variables


Add a link to the php file with these parameters:
http://yourdomain.com/hello.php?s=form-222222&customVars123=yes&adults=request123456

Where 123456 is the id we extracted earlier.

That is it.


* This blog post has affiliate links. Thank you for your support