Hi,
Could someone sugest how to backwards navigate through a set of forms?
I.e. i have created 5 different form which are part of one survey. Completing a form and navigate to the next is working, but i want to include to option to navigate back as well.
While navigating back, the values entered previously should be displayed again.
Thanks for any sugestion
Patrick
Could someone sugest how to backwards navigate through a set of forms?
I.e. i have created 5 different form which are part of one survey. Completing a form and navigate to the next is working, but i want to include to option to navigate back as well.
While navigating back, the values entered previously should be displayed again.
Thanks for any sugestion
Patrick
Hi,
just save the submitted variables into session variables on submit of any form OR you can use another way which is AJAX but this isnt easy.
Cheers
Max
just save the submitted variables into session variables on submit of any form OR you can use another way which is AJAX but this isnt easy.
Cheers
Max
Hi,
Thanks for the hint...
Could you give me an other pointer please.
I.e. when i use the following session enabled code its not working within Joomla Chronoform, whereas just as a simple webpage things work alright.
Thanks agains
Patrick
Thanks for the hint...
Could you give me an other pointer please.
I.e. when i use the following session enabled code its not working within Joomla Chronoform, whereas just as a simple webpage things work alright.
Thanks agains
Patrick
<?php
session_start();
if (isset ($_POST['submit'])){
switch($_POST['submit']){
case "Next":
//submission of form 1
$_SESSION['form1'] = serialize($_POST);
displayForm2();
break;
case "Save Data":
//submission of form 2
$form2data = $_POST;
if (!isset($_SESSION['form1'])){
die("problem here"«»);
}
$form1data = unserialize ($_SESSION['form1']);
$data = array_merge ($form1data, $form2data);
processForms($data);
break;
case "Back...":
if (isset($_SESSION['form1'])){
$form1data=unserialize($_SESSION['form1']);
}
displayForm1($form1data);
break;
default:
displayForm1();
}
} else {
displayForm1();
}
function displayForm1($array=array()){
$naam = (isset($array['naam'])) ? $array['naam'] : '';
echo '
<form action="'.$_SERVER['PHP_SELF'].'" method="post" name="Formname" target="_self">
Name: <input name="naam" type="text" size="30" maxlength="255" value="'.$naam.'"/>
<input name="submit" type="submit" value="Next" />
</form>';
}
function displayForm2() {
echo '
<form action="'.$_SERVER['PHP_SELF'].'" method="post" name="Formname" target="_self">
TelNum: <input name="telnum" type="text" size="30" maxlength="255" value=""/>
<input name="submit" type="submit" value="Back..." />
<input name="submit" type="submit" value="Save Data" />
</form>';
}
function processForms($array){
echo '<pre>'.print_r($array, true) . '</pre>';
}
?>
Hi,
I cant read all your code and debug it but my idea is that you can start session variables and give it values at the begining of each form code, dont use any extra code so things dont get complicated unless all is working good, this is better to get it working faster.
Cheers,
Max
I cant read all your code and debug it but my idea is that you can start session variables and give it values at the begining of each form code, dont use any extra code so things dont get complicated unless all is working good, this is better to get it working faster.
Cheers,
Max
This topic is locked and no more replies can be posted.