Items are doubled in an array in session
Posted: 01 Nov 2017, 07:33
Hello,
I have two files: File1: choice.php and File2: summary.php. The members of my sportclub may choose material in file 1 and see the summary in file2.
The members may switch as many times as they want from file 1 to file 2. The purpose is to see an extra line in the summary after each choice.
In File1 I have this:
and in File2 this:
The results are not what I expect:
After choice1 the following lines are visible
Line 1 is empty (no data, only hardcoded text)
Line 2 correspond to the choice made.
After choice2:
Line 2 is doubled and line 3 (corresponding to choice 2) is visible.
And so on after every choice, previous line doubled, latest choice correct.
Any idea what is going wrong?
Thank you for your help.
I have two files: File1: choice.php and File2: summary.php. The members of my sportclub may choose material in file 1 and see the summary in file2.
The members may switch as many times as they want from file 1 to file 2. The purpose is to see an extra line in the summary after each choice.
In File1 I have this:
Code: Select all
$_SESSION['summorder'][] = "my hardcoded text ".$myvar;
Code: Select all
echo implode("",$_SESSION['summorder']);
After choice1 the following lines are visible
Line 1 is empty (no data, only hardcoded text)
Line 2 correspond to the choice made.
After choice2:
Line 2 is doubled and line 3 (corresponding to choice 2) is visible.
And so on after every choice, previous line doubled, latest choice correct.
Any idea what is going wrong?
Thank you for your help.