$filename=trim($_POST['istagdel']); $filetags=file('tags.php'); preg_match('#<a href=\"(.*?)\">'.$filename.'</a>,#is', $filetags,$res); echo $res[1];