What is wrong with the following?
<ol>
<?
if (file_exists($myhotlist) && $hotarray[0] != "") {
$currentlist = file($myhotlist);
$temp = array();
for ($i = 0; $i < count($currentlist); $i++) {
$hotone = explode("|||", $currentlist[$i]);
$linktitle = str_replace (" ", "%20", $hotone[2]);
$temp[trim($hotone[1])] = stripslashes($hotone[2]);
}
asort($temp);
reset($temp);
foreach($temp as $key=>$value){
echo "<li><a href=\"".$key."\">".$value."</a><span class=\"boxlinks2\"> <a href=\"/userbookmarks/addtohotlist.php?remove=1&entryid=".$hotone[0]."&entrytitle=".$linktitle."\">remove favorite</a></span><br>";
}
} else {
echo "<h3>You don't have any Favorites saved right now.</h3>";
} ?>
</ol>
The entryid=".$hotone[0]." is being repeated for all the list, so when removing a link it doesn't remove itself but it removes one at random since all the IDs are mysteriously repeated throughout the list. The original code is shown below, <b> this only happens when the Alphabetizing code is added it by the way</b>. But no errors are displayed when I turn on my debugger.
<?php
if (file_exists($myhotlist) && $hotarray[0] != "") {
$currentlist = file($myhotlist);
for ($r = 0; $r < count($currentlist); $r++) {
$hotone = explode("|||", $currentlist[$r]);
$linktitle = str_replace (" ", "%20", $hotone[2]);
echo "<li><a href=\"".$key."\">".$value."</a><span class=\"boxlinks2\"> <a href=\"/userbookmarks/addtohotlist.php?remove=1&entryid=".$hotone[0]."&entrytitle=".$linktitle."\">remove favorite</a></span><br>";
}
} else {
echo "<h3>You don't have any Favorites saved right now.</h3>";
} ?>
</ol>