Hi, first post here for me!
I have a script that displays a form with posible choices to search for speed skating results(!). You can select the name(s) of the skaters, the arena, type of championship, minimum/maximum time used, and the distance skated. I press submit, and the results that matched the criterions in the form will show up underneath the form in a neatly organised fashion. The results are produced by mysql-queries.
These results are sorted by name. But as mentioned there are other parameters in the result-set, like the distance skated, the type of competition/championship, the time used etc.
Now, I would like to be able to click on a link with the other parameters, so that the parameter I click on is the one by which the results will be sorted. For example, I would like the results to be sorted by the distance skated, and not by the name of the skater.
I have all the algorithms clear in my head and on paper, but there is one technicality I need to overcome:
When I press the link that for example says "Distance"(I wanna sort results by distance), I need to send some variables back to the script, so I have done it like this:
<a href= "<? echo "resultater.php?sortorder=\'distance\'"."&pressed=\'on\'"."&status=".$status.'&resultatvar[]='.urlencoded(serialized($resultatvar)); ?>">Distance :</a>
[/code]
Now my problem with this, is the $resultatvar-array. This array contains all the selected items from the form that produced the current results, before the new sorting takes place.
Then, in the main script I read this array with the following code:
$resultatvar = $_GET['resultatvar'];
And the output of print_r($resultatvar) is this:
Array ( [0] => a:14:{s:10:\"navneliste\";a:1:{i:0;s:16:\"Yngve Raudberget\";}s:8:\"distanse\";a:1:{i:0;s:3:\"500\";}s:6:\"sesong\";a:1:{i:0;s:4:\"2004\";}s:14:\"konkuransetype\";a:1:{i:0;s:11:\"Kretsstevne\";}s:11:\"tid_fra_min\";s:2:\"00\";s:11:\"tid_fra_sek\";s:2:\"00\";s:11:\"tid_fra_100\";s:2:\"00\";s:11:\"tid_til_min\";s:2:\"00\";s:11:\"tid_til_sek\";s:2:\"00\";s:11:\"tid_til_100\";s:2:\"00\";s:4:\"bane\";a:1:{i:0;s:7:\"Leangen\";}s:6:\"status\";s:0:\"\";s:9:\"sortorder\";s:0:\"\";s:11:\"trykkeknapp\";s:4:\"Søk!\";} )
Now, I thought that if I used
$resultatvar = deserialize(urldecode($_GET['resultatvar']));
everything would turn out great, but then I cant read anything with print_r(). It returns blank. The results I would like to get, and what I have right before sending the value with get is this:
Array ( [navneliste] => Array ( [0] => Yngve Raudberget ) [distanse] => Array ( [0] => 500 ) [sesong] => Array ( [0] => 2004 ) [konkuransetype] => Array ( [0] => Kretsstevne ) [tid_fra_min] => 00 [tid_fra_sek] => 00 [tid_fra_100] => 00 [tid_til_min] => 00 [tid_til_sek] => 00 [tid_til_100] => 00 [bane] => Array ( [0] => Leangen ) [status] => [sortorder] => [trykkeknapp] => Søk! )
So how do I retrieve this array through this mad journey?
Any tips at all are greatly appreciated!!
I am using php 4.1.1 with apache 1.3.23(win32) on windows ME.
Hope this post wasnt too long....
Sincerely
Dominian