New to our community ?

Discover a world of possibilities! Join us and explore a vibrant community where ideas flourish and connections thrive.

One of Our Valued Members

Thank you for being part of our community. Your presence enriches our shared experiences. Let's continue this journey together!

Home php codes How to Insert form data into CSV file using PHP

How to Insert form data into CSV file using PHP


Welcome back to, In our previous post we see how to import a database using php.Today we will see how to insert a form data into  a text file with the help of PHP.

Insert form data into CSV file

Also Read : Shutdown system using PHP script.

Print numbers from 1 to N without using loop in PHP.

Import data from text file to MySQL using PHP.

Check PHP Script execution time measure.

Create a dynamic Calendar Using PHP.

    $file_open = fopen("ankit.csv", "a");
    $form_data = array(
      'name'    =>  $name,
      'email'   =>  $email,
      'subject' =>  $subject,
      'message' =>  $message,
    fputcsv($file_open, $form_data);
    echo $error = '<label class="text-success">Thank you for contacting us</label>';
    $name = '';
    $email = '';
    $subject = '';
    $message = '';
  <!DOCTYPE html>
  <form method="post" action="">
    <input type="text" name="name"><br>
    <input type="text" name="email"><br>
    <input type="text" name="subject"><br>
    <input type="text" name="message"><br>
    <input type="submit" name="submit">

Also Read : How to create a facebook like chat system using PHP ,AJAX and MySQL.

Send Mail Without SMTP Authentication in PHP.
Create a dynamic progress-bar using PHP.

Generate Enrollment-number using PHP.

Decode JSON format using PHP function