Hi
The solution depends if you are doing any submits and then doing any header() functions in the submit php pieces.
If you are just moving between form pages in javascript with say ff_page1 or ff-switchpage(target_page) then you can use either a global variable or a hidden element. Pages inside ff are NOT web pages but if you use a header() in a submit piece to return to your form then you are reloading the form so it will reinitialise.
Assume you have a hidden element called prev_page. Further assume your form starts at page 1 so when creating element prev_page set its vale to 1 (as an integer). In the custom button action scripts on each page that is to return to previous you put in something like
target_page = ff_getElementByName('prev_page').value; //get the page number we came from
ff_getElementByName('prev_page').value = ff_currentpage; //set prev_page to be the one we are just leaving
ff_switchpage('target_page');
Actually you could make the above into a function called say go_back and put it in one of the buttons on say your start page
function go_back()
{
var target_page = ff_getElementByName('prev_page').value; //get the page number we came from
ff_getElementByName('prev_page').value = ff_currentpage; //set prev_page to be the one we are just leaving
ff_switchpage('target_page');
return;
}
You then just need to put a go_back(); in each action button custom code that switches back to a previous page.
In those buttons where you are not going back but you need to return back to them the only line you need in the action code itself is
ff_getElementByName('prev_page').value = ff_currentpage; //set prev_page to be the one we are just leaving
Note this does not work if you do a submit as that will reload the form and reinitialise it. Also the global variables are reset. If you are doing submits then you will need to enter into php with before form and before submit pieces and use a parameter to remember contents of prev_page. I recently wrote a note on that at in Basic Form topics "Database app return to sender redirection which may help a little
http://www.facileforms.biz/forum/index.php/topic,6147.0.html In your case you would be saving and restoring 'prev_page' element and using the go_back function as above