Web Form - E-mail CSV with User input

Published on
4,432 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

Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

Join & Write a Comment

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…
This is Part-2 of Learning to use the Power of Mailwasher Pro so if you haven't watched Part-1 yet, I urge you to do so before watching this video. Click this link to watch Part-1 (https://www.experts-exchange.com/videos/56638/Learn-to-use-the-POWER…

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month