Ok I managed to print the values and count each element in the array with this
$i=0;
foreach ($cart as $item)
{
print "<tr><td>$item<a href=$PHP_SELF?DID=$i&DMN=$domain><span class=style7>[remove]</span></a></td></tr>";
$i++;
}
print("</table>");
But now the problem is it will not delete these elements once I clicked the [remove] link
It just reloads the page without any changes.
This is what I have at the top of my script.
<?
session_start();
if (isset($_POST['domainadd']))
{
$domain = $_POST['domainadd'];
$cart = $_SESSION['cart'];
$cart[] = $domain;
$_SESSION['cart'] = $cart;
$domain = substr($_POST['domainadd'],0,-4);
}
if ($_GET['DID']){
$element = $_GET['DID'];
unset($cart[$element]);
$domain = $_GET['DMN'];
}