Formulaire
RĂ©ponse ";
foreach ($_POST as $cle => $valeur) {
echo "
$cle : $valeur
";
}
if ($_POST["sortie"] == "txt") {
file_put_contents("data2.txt", $_POST['prenom'] . " " . $_POST['nom'] . " " . $_POST['email'] . " " . $_POST['url'] . " " . $_POST['userIP'] . " " . $_POST['userDATE'] . "\n", FILE_APPEND);
} else if ($_POST["sortie"] == "csv") {
$fp = fopen('data2.csv', 'a');
fputcsv($fp, $_POST);
} else if ($_POST["sortie"] == "json") {
$actuel = file_get_contents('data2.json');
$listeTemp = json_decode($actuel);
if (is_array($listeTemp)) {
array_push($listeTemp, $_POST);
} else {
$listeTemp = array($_POST);
}
$donneesJson = json_encode($listeTemp);
file_put_contents('data2.json', $donneesJson);
}
}
?>