Buy Now
Sign in

Why does DBSave execute after redirect?

peterswa62 , October 29 2012
p
peterswa62

Why does DBSave action still execute if there is a redirect before it? I need to re-direct if someone presses the Cancel button.

GreyHead

Hi peterswa62,

I don't think that it does. There's not enough information here to say much else.

Bob

ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much

p
peterswa62

It does!

I put something like this in a custom code block BEFORE DBSave on the On Submit event:-

<?php header( 'Location: http://www.yoursite.com/' ) ; ?>

It re-directs to the URL OK, but then it executes DB Save which is not what I want.

I put a Show Stopper after custom code and that stops DB Save from executing but that means DB Save will never execute!

GreyHead

Hi peterswa62,

As I said, there wasn't enough information to say much.

If you want to redirect then either the ChronoForms ReDirect action, or a custom code action using $mainframe->redirect() will do it.

I'm not sure what your PHP does but I suspect it has no effect until the next page is displayed.

Bob

ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much