Web Form - E-mail CSV with User input

Published on
4,502 Points
Last Modified:
I made this because I wanted to get e-mail with a attached csv file so I'd would be able to import user input into a MS Excel template, but I also wanted to register/save all inputs from each day in a file on the server.

1st - It creates a temp CSV file that is attached to the e-mail to me with the comma separated inputs.

2nd - If there hasen't been any inputs from that day it make a new CSV file on server or if there has been inputs from that day they are appended to the existing file.
After spending tons of time reading up on the subject i made this code script, that will let you get the user input sent to you as a E-mail with a CSV file attachment.

HTML code (user input): index.html

PHP code: php-form.php

The PHP code as it is at the moment will make two CSV files.
One that is stored on the server that holds all inputs from that day $fp = fopen("file".date("d-m-y").".csv",'a');
and the one that is e- mailed to the chosen e-mail $FileName = $formdata.date("d-m-y-h:i:s").".csv";

I'm working on getting it to send the inputs in the E-mail message also.

Hope you can use it, modify it etc.
Brian A.

I'm currently testing a new version that also sends the user a message that displays the input in a mail with a table layout, It just lacking a bit of fine tuning, but is looking good.

I bet that many of you that tried to make a web form been battling with malformed char set, that's my last hurdle in one of the mail headers.

Featured Post

OWASP Proactive Controls

Learn the most important control and control categories that every architect and developer should include in their projects.

The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
Discover the basics of using Outlook 2016 from office 365.

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month