PHP Classes
elePHPant
Icontem

Double items in an array

Recommend this page to a friend!

      Top level forums  >  PHP Specialists  >  General  >  Double items in an array  
Subject:Double items in an array
Summary:How to avoid double items in an array
Messages:2
Author:Eric Justus
Date:2017-08-08 16:32:56
Update:2017-08-08 17:19:30
 

  1. Double items in an array   Reply   Report abuse  
Eric Justus - 2017-08-08 17:19:30
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:
$_SESSION['summorder'][] = "my hardcoded text "$myvar;
and in File2 this:
echo implode("",$_SESSION['summorder']);
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.




There is 1 reply in this thread, which is not being displayed.
Browsing this forum thread replies is available only to premium subscribers.


Go to the premium subscriptions page to learn how to become a premium subscriber and have full access to this forum.