Link to home
Create AccountLog in
Avatar of jason5655

asked on

Importing Web forms into a database

Hi EE,

I have a bunch of Web forms that are generated from customers filling out their contact informations and requesting a number of packages.  I receive the contents of the web forms as e-mails that I sort into a specific folder on my computer and save as a text file in MS Outlook (see attached file for an example).  This process puts all the e-mails into one text file. My question is how to go about importing this information into a database?  Should I create a PERL script that will take everything after a colon and place it into a CSV file and start a new record at the next FROM.  Many thanks for your input.

Happy New Year, Jason
Avatar of Steve Tempest
Steve Tempest
Flag of Australia image


I'd look at having the form insert the info directly into the database and then optionally email it to you the info also if that is what is required.

This removes the manual part of the process which I would think is quite time consuming.

Avatar of jason5655


I would like the web form to directly insert the information into the database but the server that is hosting our web site does not have our contact database on it.  This is my only option for moving data between them at the moment.

Thanks, Jason
What's your web form written in? Does it pass to a cgi script of is it done in php or asp?

It's possible that you could alter the form so that it writes the details out to csv format and attaches that to the email that it's sending you.

But then I would have to import each file one at a time.  It would work best if I could dump all the e-mails into one text file and then generate a CSV file from all the submissions for that day.
yep fair enough.

How about altering the form so that it includes a single line in the email body with csv format

CSV: info,from,form

Then when you export the emails you can just filter down for lines that begin with CSV: and create a single file quite easily.

You could write a perl script to do the other stuff but I think it's best if you get the form to do the bulk of the work. In fact you could just install gnu utilities and use cat and grep to get the csv out with only one or two commands.

I tend to agree with the posts above.  Starting with better delimited would probably be best.  Trying to parse the file you uploaded would be a nightmare.

What programming options do you have available on the back end?  Could you not programmatically write code to process the Outlook emails for you?

Check out:
Avatar of Jim P.
Jim P.
Flag of United States of America image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account