I have an array something like this
$steps = explode("[;;]",$str);
So the $steps holds value that I have to use to show a step/step procedure in PHP .
The array looks like this
$steps = array('corredores' , 'something' , 'something'...and so one );
I am trying to display forms according to the value saved in the array . I am able to go forward using some validation but I have trouble in moving to the previous name in the array , for the first step I am doing something like this
$steps = explode("[;;]",$_POST['str']);
$x = explode("=",$steps[0]);
$pais1 = $_POST['pais'];
$cnt=0;
switch($steps[0]){
case 'categorias' :
include 'obj/categorias.php';
//$step='categorias';
break;
case 'corredores':
include 'obj/corredores.php';
//$step='corredores';
break;
case 'monedas':
include 'obj/monedas.php';
//$step='monedas';
break;
case 'location':
include 'obj/location.php';
//$step='location';
break;
default:
break;
}
//Here I am trying to match the next value from the array that I will save in this post value on every step
if(isset($_POST['next1']) &&$_POST['method'] != "fase1")
{
$cnt =$_POST['cnt'];
$cnt++;
$array_var = unserialize(base64_decode($_POST["next1"]));
$steps = $array_var;
$pais1 = $_POST['pais'];
$x = explode("=",$array_var[$cnt]);
include 'obj/'.trim($x[0]).'.php';
//$step='categorias';
}
So when I click on the next button of each file it goes to the next file in the array , But Now I need to add similar functionality to the previous button so that it goes back
The HTML content of every files has following structure
<form method="post" action="./index.php" name="form_name">
<table><tr><th>Some Name</td></tr>
<tr><td><input type="submit" value="previous"></td><td><input type="submit" value="next"></td></tr></table>
<input type="hidden" name="next1" value="<?php print base64_encode(serialize($steps)) ?>">
<input type="hidden" name="pais" value="<?php echo $pais1?>"/>
<input type="hidden" id="cnt" name="cnt" value="<?php echo $cnt ?>" />
</form>
Can any one give me some suggestion
Thanks in Advance