How can i write a html <a href..> and when i click it, a content of a .txt file should be erased?
I tried with
Code: Select all
<a href="$fp = fopen("in.txt", w); fclose($fp);">Sterge continut fisier intrare</a>
Please help.
Thanks
Moderator: General Moderators
Code: Select all
<a href="$fp = fopen("in.txt", w); fclose($fp);">Sterge continut fisier intrare</a>
hmm.. and how should this be done? i need another php page for this?Sephern wrote:I'd add a $_GET parameter, then put the relevant code in an isset.
Code: Select all
if(!isset($_GET['delete']))
{
echo '<a href="'.htmlentities($_SERVER['PHP_SELF']).'?delete=1">click</a>';
}
else
{
//....delete file...
}