Redirect after save

3 posts by 2 authors in: Forums > CMS Builder
Last Post: February 3, 2012   (RSS)

I've set-up related records to appear at the bottom of another record, in this case it's product availability records to appear at the bottom of a product record in the CMS.

I can add a separator using custom HTML for 'Create new record' which takes the user to the form to add a new product availability record but when they save this, they are taken back to the product availability section within the CMS.

Is it possible that after saving the record, I redirect them back to the product record that were looking at previously?

Thanks, Paul.

Re: [pothompson] Redirect after save

By (Deleted User) - February 1, 2012

Hi Paul,

In order to set the previous url you need to add the variable 'return_url=' with the previous query html encoded as the value.

In your HTML separator, where you have the link to create a new record added, try the following:
$current_query = htmlspecialchars($_SERVER['QUERY_STRING']);

$link = [current link]&returnUrl=$current_query;


The above is just an example, you'll need to tweak it to fit your code. The important bit is grabbing the current page view query ($_SERVER['QUERY_STRING']) and adding it to the end of the link so that it's passed in the URL.

Hope this helps,

Tom