mercredi 6 mai 2020

Insert html module in the txt file

I wanted to know how it was possible to transcribe an html form into a txt text file. I don't have much experience with the PHP language, however, by searching the internet I managed to put something up:

<?php

$file = "testo.txt";

$fp = fopen($file, "a");

fputs($fp, htmlspecialchars($_POST["nome"]) 
       . " " . htmlspecialchars($_POST["cognome"]) 
       . " ". htmlspecialchars($_POST["select"] . "\r\n");

fclose($fp);
?>

The problem is that as soon as I integrate the php file into html and send the form, the php file is opened in my browser and the text file is not created, does anyone know how to help me? This is the part of code in html:

<form class="form-login clearfix" method="POST" action="prova.php" enctype="text/plain”>
    <input type="hidden" name="dep" id="dep" value="">
    <input type="hidden" name="dop" id="dop" value="">
    <input type="hidden" name="evp" id="evp" value="">
    <input type="hidden" name="mid" id="mid" value="">
    <input type="hidden" name="rememberme" id="rememberme" value="">

if it is not possible to transcribe it in a txt file it is enough for me to have a way to export it without the user having to click anything, in fact I also tried with "mailto" but asks the user to send the email.




Aucun commentaire:

Enregistrer un commentaire