Glass wrote:
> First: I need one solution where global variables are
allowed on the host
> server as well as one where they are not or a solution
where it does not matter
The first thing you need to understand is how PHP works. The
script runs
each time the page is called, but the web is a "stateless"
environment.
That means that each request to a web server is completely
independent
of any other. Consequently, your script is condemned to live
in
ignorance of previous requests.
The way round this is to use session variables, but remember
that a
session has a limited life (usually 14 minutes).
> if(isset($_GET['id']))
> {
> $select[$i] = $_GET['id'];
> $i = $i + 1;
> }
> foreach ($select as $selected) { echo $selected."<br
/>";
<?php
session_start();
if (isset($_GET['id'])) {
$_SESSION['select'][] = $_GET['id'];
}
if (isset($_SESSION['select'])) {
foreach($_SESSION['select'] as $selected) {
echo $selected.'<br />';
}
}
--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of
ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/