Forums

Multipage - Save to session on back button?

morphz 12 Feb, 2018
Hello everyone.

I set up a multipage form.

I'd like to save the data they enter on step 2 when they click the back button to step 1. So it will still be there when they go forward and come to step 2 again.

Has anyone done that yet? if so how did you do it?

The back buttons work I just don't know how to save it to the session.
Maybe with a submit and redirect?

Any help appreciated :-)

Greetings
morphz
morphz 12 Feb, 2018
Can't edit at the moment. That's my form:

http://farb-formulare.jdevcloud.com/formulare/auftragserfassung-reinigung
GreyHead 12 Feb, 2018
Hi morphz,

You can do this with a second Submit button. After the form submits you need to process it as normal including the data save - then check to see which Submit button was clicked and redirect to the matching page.

Bob
morphz 12 Feb, 2018
Thanks for the reply Bob

I am a bit confused.

#1. The submit buttons load the event I declare in the display section. Correct?
#2. As far I understand I add just one more event as target of all display sections where all the buttons and their matching redirectings are saved. Correct?
#3. What elements do I need to use in this event? How can I determine which submit button was clicked? php? or is there an easier way.

Thanks in advance!
GreyHead 13 Feb, 2018
Hi morphz,

1. Yes

2. I don't think so but I'm not sure what you are saying.

3. You can tell which button is clicked by checking the value which is submitted by the button element.

Bob
morphz 20 Feb, 2018
I am not familiar with php. can you help me with the code?

Or am I approaching this wrong..

Thanks!
<?php
$value1 = $_POST["button19"];
$value2 = $_POST["button141"];

if ($value1 or $value2 == "Personalien") {
header("Location: http://example.com/Page1.php");
}
if ($value1 or $value2 == "Adressen") {
header("Location: http://example.com/Page3.php");
}
?>
This topic is locked and no more replies can be posted.