PHP 7 Script to Save HTML5 Form Data inside a Text (.txt) File and Download it in Browser Full Project For Beginners

  • Post author:
  • Post category:PHP
  • Post comments:0 Comments


Welcome folks today in this blog post we will be saving html5 form data inside a text (.txt) file and download it in browser using php 7. All the full source code of the application is shown below.




Get Started




In order to get started you need to make an index.php file and copy paste the following code






<!DOCTYPE html>
  <title>Store form data in .txt file</title>
  <form method="post">
    Enter Your Text Here:<br>
    <input type="text" name="textdata"><br>
    <input type="submit" name="submit">



$fp = fopen('data.txt', 'a');

fwrite($fp, $data);

Leave a Reply