Fix csv file not creating if data folder doesn't exist
This commit is contained in:
3
add.php
3
add.php
@@ -7,6 +7,9 @@ $voto = $_POST['voto'];
|
|||||||
|
|
||||||
$item = [$nome,$classe,$dataValutazione,$tipo,$voto];
|
$item = [$nome,$classe,$dataValutazione,$tipo,$voto];
|
||||||
|
|
||||||
|
if(!is_dir("data")){
|
||||||
|
mkdir("data");
|
||||||
|
}
|
||||||
if(file_exists("data/voti.csv") == false){
|
if(file_exists("data/voti.csv") == false){
|
||||||
$file = fopen("data/voti.csv", "w");
|
$file = fopen("data/voti.csv", "w");
|
||||||
fwrite($file, "Nome alunno,Classe,Data valutazione,Tipo valutazione,Voto\n");
|
fwrite($file, "Nome alunno,Classe,Data valutazione,Tipo valutazione,Voto\n");
|
||||||
|
|||||||
Reference in New Issue
Block a user