Jump to content


Photo

Populating array on page reload


  • Please log in to reply
1 reply to this topic

#1 monkeymax

monkeymax
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 11 March 2006 - 03:45 AM

I've been unsucessfully trying to get this to work for the last hour so I thought I would turn to the experts!

The situation is that I have a page of matches that I would like the user to select from. Say the page is called "matches.php". The table would look like:

Match 1 Dog vs Cat
Match 2 Praying Mantis vs Butterfly
....

The match players are links, and the match number and player id are passed back to the page, so Dog would be linked as:
<a href="matches.php?match=1&amp;player="Dog">Dog</a>

Now my problem is when the page is reloaded, I want these details to be stored in an array. I thought it would be as simple as:

if(!isset($_GET['match'])){
$match_array=array();
}

else{
$match_array[$_GET['match']] = $GET['player'];
}

Which would be working perfectly except for the fact that the array gets reloaded everytime I load the page, so it only ever has one entry. I would like it to store all previous match data. I don't have much experience with static and global variables and was hoping someone would be able to suggeset a solution for this,

Thanks!

#2 k.soule

k.soule
  • Members
  • PipPipPip
  • Advanced Member
  • 30 posts
  • LocationIllinois

Posted 11 March 2006 - 04:44 AM

Pass the array with sessions, simplest solution I can think of.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users