Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

118
Views
How to save the HTML form data to a .txt file on server

I want to save the HTML form data to a .txt file on the server. I tried to use HTML+PHP, but nothing happened.


Code part:
HTML:

<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:
<?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);
?>  
about 4 years ago · Santiago Gelvez
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!