Change information in a external txt file "onclick"
Posted: Mon Aug 18, 2003 10:16 am
Hi, i tested a code to add and print information of a texte file... it works now what i wanted to do is on a click, add something or on click erase the file content...
this was my code
i created this function... and what i want is when i click on a hyperlink i want it to add the content (in this case $zip is an array).
so basically i ll need to put an onclick="" .. but i don t know what to put there...
ps : i m not familiar with php at all...not yet
thx
this was my code
Code: Select all
<?php
$filename = "includes/fichier.txt";
$fp = fopen( $filename, "w" ) or die("$filename not found");
fwrite( $fp, "Hello world\n" );
fclose( $fp );
$fp = fopen( $filename, "a" ) or die("$filename not found");
fputs( $fp, "And another thing\n" );
fclose( $fp );
if (!$file = fopen("includes/fichier.txt","r")) {
echo "Can't open the $filename";
exit;
} else {
while(!feof($file)) {
$Ligne = fgets($file,50000);
echo $Ligne;
$Fichier .= $Ligne;
}
fclose($file);
}
?>Code: Select all
function write() {
$file = fopen("includes/clients.txt","a");
fputs($file, "\n");
fputs($file, $zip);
fclose($file);
}ps : i m not familiar with php at all...not yet
thx