Hi
I have a HTML form which posts to a PHP script.
On the PHP script I have
$_SESSION['mystuff'][] = array('idnumber'=>''.$_SESSION['myID'].'','titlename'=>''.$_POST['productname'].'');
and basically this array builds up each time the form is submitted
I then output this data using
$num=0;
foreach($_SESSION['mystuff'] as $mystuffvals)
{
print $_SESSION['mystuff'][$num]['titlename'];
print "<br>"
$num = $num+1;
}
this all works fine, but I want to be able to add a "delete" link next to each one so that it can be removed.
how possible is that?
I did try adding
<a href="?remove=<?php print $num; ?>
under the bit of code
print $_SESSION['mystuff'][$num]['titlename'];
and then running something at the top of the page which looks like
if(isset($_GET['remove']))
{
unset($_SESSION['mystuff'][$_GET['remove']]);
}
?>
but that seems to unset random arrays and I can't think what could be wrong.
Please help
Thanks
J