A quick look shows that you use
Code:
$deleteId = trim($_POST['delURL']);
but do not give it to your function deleteBookmark();
2nd:
Code:
for($i=0; $i<count($bookmarks); $i++) {
//seperate each element and store it in a temporary array
$tmp = explode(',', $bookmarks[$i]);
//assign each element of the temporary array to an accossiative array key, overwriting the first $bookmarks entry
$bookmarks[$i] = array('name'=>$tmp[0], 'URL'=>$tmp[1], 'category'=>$tmp[2], 'date'=>$tmp[3], 'counter'=>$tmp[4]);
}
$match = false; //you use it later but never set it.
//loop through the array, see if there's an 'id' match
for($i=0; $i<count($bookmarks); $i++) {
if(trim($bookmarks[$i]['link']) == $deleteId){
//unset the bookmark entry if there's a match
unset($bookmarks[$i]);
$match = true;
break;
}
}
as the code shows you do not have a "link" to eval against as you try in this code pcs: trim($bookmarks[$i]['link']) == $deleteId).
It should be $bookmarks[$i]['URL']).
3rd:
You can properbly see it youself when you read this: $fh = fopen("txt/favourites.txt", "w"); (hint path is a bit wrong).
Working code:
http://pastebin.com/rmqK92Jy
/**** Edit - remarks ****/
At line 30 you make a check on isset($_GET["sort"]), to see if its present
At line 31 you sign $_GET["sort"] to $order.
The code/script after this will make errors if(!isset($_GET["sort"])). This can be fixed by doing like this:
PHP Code:
if(!isset($_GET["sort"])){
$_GET["sort"] = "name";
}
$order = $_GET["sort"];
At line 32 you create a file handle but never uses it. You can delete this line due to:
At line 33 you read the content of you file fav*.txt into an array
Because you only read the content of the file at this moment you do not need a file handle.
At line 64 you create the "<tr" tag, but you dont create it proper ^^. Fix <tr>