Forums

Why does DBSave execute after redirect?

peterswa62 29 Oct, 2012
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 29 Oct, 2012
Hi peterswa62,

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

Bob
peterswa62 29 Oct, 2012
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 30 Oct, 2012
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
This topic is locked and no more replies can be posted.