Answer the question
In order to leave comments, you need to log in
json file iteration?
Good afternoon, when submitting the form, I try to pull the files into json , json itself is created, but when resending a new file is not created, for example, a person sends the form 1.json is created, sends the next one and 2.json is created accordingly.
<?php
$post = (!empty($_POST)) ? true : false;
if($post) {
$name = $_POST['name'];
$phone = $_POST['phone'];
$viber = $_POST['viber'];
$whatsapp = $_POST['whatsapp'];
$telegram = $_POST['telegram'];
$tel = $_POST['tel'];
$date = date_create();
$filename = "" . strval(count(glob('./json')) + 1) . ".json";
$insertvote = [
'Имя: ' => $name,
'Телефон: ' => $phone ];
$pretty = json_encode($insertvote, JSON_UNESCAPED_UNICODE);
$fp = fopen($filename,"w");
fputs($fp,$pretty);
fclose($fp);
$error = ''; ?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question