Forums

how to change form action URL based on a Variable's value

ajw3208 05 Jan, 2010
Hi Bob,

Is there a way to do the following.

I need to change the submit URL depending on what value a particular variable in the form is
if ($var1=OK) submit to https://www.paypal.com/webscr........ }
else{submit to http://site1/process/processthis.php}


When $var1 ='OK' the button shown on the form = PayPal otherwise the button shown = 'Finish'.

Having the PayPal URL in the form action box works if you only want to go to Paypal. I need to be able to dictate which site the form gets submitted to and subsequently processed by.

Thoughts?

aj
GreyHead 05 Jan, 2010
Hi ajw3208,

You can't dynamically change the OnSubmit URL in the server because having the URL set means that ChronoForms never sees the form results.

I guess that you could change it with JavaScript in the Form.

Or you could allow the form to submit to ChronoForms and use PHP to build one redirect url or the other.

Bob
This topic is locked and no more replies can be posted.