Quiero guardar los datos del formulario HTML en un archivo .txt en el servidor . Traté de usar HTML+PHP, pero no pasó nada.
<form action="?survey.php" method="post"> Your E-mail address: <input type="text" id="emails" placeholder="Enter your E-mail address" required email-address><br /> <input type="submit" value="提交"> </form> <?php $file_emails = "emails.txt"; $line = 0; $fp = fopen($file_emails , 'r') or die("open file failure!"); if($fp) { while(stream_get_line($fp,8192,"\n")) { $line++; } fclose($fp); } $line++; $string_emails = "Respondent "+$line+":"+$_POST["emails"]+"\r\n"; file_put_contents($file_emails,$string_emails); ?>