close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Redirect to previous page after update

Thread began 10/25/2013 10:14 pm by danny405167 | Last modified 10/29/2013 10:35 am by Jason Byrnes | 3225 views | 7 replies |

danny405167

Redirect to previous page after update

I have been trying to find in the forums for a solution on how to redirect to a previous page after the update button has been clicked. For example if I am on page-1.php and click on a record to go to the updatePage-Rec.php...I would like to return to page-1.php and the same if I were on page-2.php.

I tried to follow the following:
Use the server behavior "Set Session Value" on each page that links into the form. Set the same session variable name with the value corresponding to the page name you are on.

But the page does not redirects.

I created a Session Variable on my product-options.php, named previousPG then I set the Session value to
Trigger: any form post
Session name: previousPG
Value: productioptions.php

On my productoptions-edit.php page I set the After Update Go to value to <?php echo $_SESSION['previousPG']; ?>

Sign in to reply to this post

Jason ByrnesWebAssist

if you echo the session in the body of the update page, does it show a value?

try adding the following code at line 1 of the update page to force php to look for the session:

<?php @session_start(); ?>
Sign in to reply to this post

danny405167

No value is shown.
This is what I have on top of my _PRODUCT_EDIT.php

<?php @session_start(); ?>
<?php require_once('../../Connections/dbConnect.php'); ?>
<?php require_once("../../webassist/file_manipulation/helperphp.php"); ?>
<?php require_once("../../webassist/database_management/wa_appbuilder_php.php"); ?>
<?php
if (!session_id()) session_start();
if($_SERVER["REQUEST_METHOD"] == "POST") {
$_SESSION["previousPG"] = "_PRODUCT_EDIT.php";
}
?>

and this is what I have on top of my _PRODUCT_OPTIONS.php page

<?php @session_start(); ?>
<?php echo $_SESSION['previousPG']; ?>

No value is displayed and the update server behavior does not update the record

Sign in to reply to this post

Jason ByrnesWebAssist

I'll need to troubleshoot directly, see the private message section.

Sign in to reply to this post

danny405167

Originally Said By: Jason Byrnes
  I'll need to troubleshoot directly, see the private message section.  
Sign in to reply to this post

Jason ByrnesWebAssist

You have a few probelms, i fixed then on the products options pages, but the same problems exist on the other set

1) on the PRODUCT-OPTIONS.php page, the trigger for setting session is any form pagst, i changed that to page load:
<?php
if (!session_id()) session_start();
if("" == "") {
$_SESSION["previousPG"] = "PRODUCT-OPTIONS.php";
}
?>

2) the echo of the session should not be in the hwead of the documat, you should add it to the body, otherwise it will cause errors.

3) you have code on the edit page to destroy sessions
<?php
@session_destroy();

@session_regenerate_id();

?>

this means that the sessions no longer exist when the update form is submitted. needs to be removed.

Sign in to reply to this post

danny405167

Thank you. You saved me 2 unnecessary pages that I would have to create.

I have at home a MAC with OS Lion and DW CS 6. On my Mac I am able to delete SESSION Variables by clicking on the minus sign in the Binding panels. Also, I am able to set a Session value without any problems. At work I use a Windows 7 Pro with DW CS 6. I was not able to delete a Session variable from the Binding panels. When I try to set a Session value, the following error message appear "You already have a variable named "previousPG". Please enter a unique name." I am sending an image for you to see that I did not have a Session value before I click on the Server Behaviors Panel plus sign -> Webassist -> Cookies -> Set Session Value. Why would this error appear when clearly I there is no php code on the page.

Sign in to reply to this post

Jason ByrnesWebAssist

Use your OS File Browser to browse to your site files and delete the _notes folder.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...