Stuff that... i got that bit working now,
BUT... what i'm trying to do now is delete part of an array but yet again i'm getting a 'page cannot be displayed' error. The address is the address bar is perfectly fine. Heres the code that constructs the link:
if ($_GET['imagename']!="") {
$iname = $_GET['imagename'];
if (!isset($_SESSION['currentfiles'])) {
$_SESSION['currentfiles'] = $iname;
$attachedfiles = "<li>".$iname."<font size='-1'> - <a href='ForumDiscardImage.php?arraynumber=0&threadid=$threadid§ionid=$sectid'>Discard Image</a></font></li>";
}else{
$sesh = $_SESSION['currentfiles'];
$exploded1 = explode(",", $sesh);
$inarray1 = count($exploded1)-1;
if ($exploded1[$inarray1]!=$iname) {
$sesh = $sesh.",".$iname;
}
$_SESSION['currentfiles'] = $sesh;
$exploded = explode(",", $sesh);
$inarray = count($exploded);
if ($inarray==6) {
$imglink = "ForumMaximum.php";
}else{
$imglink = "ForumPostImage.php?threadid=$threadid§ionid=$sectid";
}
for ($i=0; $i<count($exploded); $i++) {
$attachedfiles .= "<li>".$exploded[$i]."<font size='-1'> - <a href='ForumDiscardImage.php?arraynumber=$i&threadid=$threadid§ionid=$sectid'>Discard Image</a></font></li>";
}
}
unset($iname, $inarray, $exploded, $exploded1, $inarray1, $sesh, $i);
$attachmessage = "<b>Images currently attached:</b><br><br> <i>".$attachedfiles."</i><br>";
}
And heres the code thats supposed to delet the element from the array but the page is saying it cannot be displayed:
$arraynumber = $_GET['arraynumber'];
$tfid = $_GET['threadid'];
$sfid = $_GET['sectionid'];
$sesh = $_SESSION['currentfiles'];
$exploded = explode(",", $sesh);
$inarray = count($exploded);
if ($inarray==1) {
unset($_SESSION['currentfiles']);
unset($arraynumber, $sesh, $exploded, $inarray);
header("location: ForumNewReply.php?threadid=$tfid§ionid=$sfid");
exit();
}else{
for ($i=0; $i<$arraynumber; $i++) {
$sess1 .= $exploded[$i].",";
}
for ($i=$arraynumber+1; $i=$inarray-1; $i++) {
$sess2 .= $exploded[$i].",";
}
$finalsess = $sess1.$sess2;
$finalsesh = substr_replace($finalsess, "", -1);
$_SESSION['currentfiles'] = $finalsesh;
$exploded1 = explode(",", $finalsesh);
$inarray1 = count($exploded1)-1;
$lastitem = $exloded1[$inarray1];
unset($arraynumber, $sesh, $exploded, $inarray, $sess1, $sess2, $finalsess, $finalsesh, $exploded1, $inarray1, $i);
header("location: ForumNewReply.php?threadid=$tfid§ionid=$sfid&imagename=$lastitem");
exit();
}
Would someone mind PLEASE looking through and trying to see where i've gone wrong... i've bin studying it for hours and can't work it out.
Many Thanks, BIOSTALL