boh, prova![]()
Ciao.Codice PHP:
<?php
function sceglinomefile($file, $number=1) {
if(file_exists($number . "_" . $file)) {
return sceglinomefile($file, $number+1);
}else{
return $number . "_" . $file;
}
}
$nomefile = "form_compilato.txt"; //metti il nome del file
$txt = "";
foreach($_POST as $key => $value) {
$txt .= "$key: $value\n";
}
$fp = fopen(sceglinomefile($nomefile), "w");
fwrite($fp, $txt);
fclose($fp);
?>