+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 11
Like Tree2Likes

Thread: re: How to save form data as csv

  1. #1
    jdaniels is offline x10Hosting Member jdaniels is an unknown quantity at this point
    Join Date
    Nov 2007
    Posts
    11

    re: How to save form data as csv

    Hi,

    I have a webpage that asks participants to fill in answers to questions. At the moment the form gets emailed to me, but it came up as postdata.att or as a text file. I need to get this information into excel.

    I want the following to happen: When someone presses submit on the webpage the data entered should save as a csv file, which I can then import excel at a later stage (after Xmas)

    Can someone either help or point me in the right direction

    Thanks

  2. #2
    adrenlinerush's Avatar
    adrenlinerush is offline x10 Lieutenant adrenlinerush is an unknown quantity at this point
    Join Date
    Nov 2007
    Location
    Monmouth, IL
    Posts
    379

    Re: How to save form data as csv

    csv is simply a text format.... it comma delimited file if a comma is in the data then it is in quotes ... if thier is a quotes in the data then two sets of quotes example

    data1,"data two, data three", "data four "" more data"

    this evaluates to
    col 1 data
    col 2 data two, data three
    col 3 data four " more data
    Last edited by adrenlinerush; 12-05-2007 at 08:25 AM.
    Austin Mount
    AAS, A+, Compaq/HP APS
    austin@adrenlinerush.net

  3. #3
    jdaniels is offline x10Hosting Member jdaniels is an unknown quantity at this point
    Join Date
    Nov 2007
    Posts
    11

    Re: How to save form data as csv

    At the moment my submit script directs the form data to be submitted as an email. I want to get the answers to the various questions into excel with a unique identifier. I have no idea at the moment as to how to do this.

    I need a simple solution. Can someone help?

  4. #4
    adrenlinerush's Avatar
    adrenlinerush is offline x10 Lieutenant adrenlinerush is an unknown quantity at this point
    Join Date
    Nov 2007
    Location
    Monmouth, IL
    Posts
    379

    Re: How to save form data as csv

    ok what language are you using for cgi.... perl?, php?, python? ruby?

    simply the script must do a few things...
    accept the cgi post
    create a text file in csv format described above
    create an email probably using sendmail
    attach the csv text file to the email before submitting it to sendmail
    Edit:
    actually you probably just want to append one file and leave it on the web host until you're ready to look at the data
    Edit:
    some perl snipit that will do the job

    (1) collect the input data

    use CGI();
    my $form = new CGI();
    my %Data;
    for($form->param)
    { $Data{$_} = $form->param($_) }


    (2) output this data to a file

    open (F,'formData.txt') or die "Open failed: $!\n";
    for(keys %Data) { print "Data{$_} eq $Data{$_}\n" }
    close F or die "Close failed: $!\n";
    Last edited by adrenlinerush; 12-05-2007 at 08:35 AM. Reason: Automerged Doublepost
    Austin Mount
    AAS, A+, Compaq/HP APS
    austin@adrenlinerush.net

  5. #5
    jdaniels is offline x10Hosting Member jdaniels is an unknown quantity at this point
    Join Date
    Nov 2007
    Posts
    11

    Re: How to save form data as csv

    Hi,

    My webpage is at the following address - http://www.jdaniels.x10hosting.com/
    It's a really simple page, but I do not understand what you've said. Not because it is wrong, but because I am new to this and it doesn't make sense to me. I understand the concept but not sure how to create the necessary files. Would it be possible to do this for me? It would have been straight forward as I had a formmail.php script created, but my work server doesn't accept php files. You will find reference in the above link to this, which I need to amend.

    Why is life so complicated at times!!!!

    Yours

    Getting frazzled
    karimirt47 likes this.

  6. #6
    adrenlinerush's Avatar
    adrenlinerush is offline x10 Lieutenant adrenlinerush is an unknown quantity at this point
    Join Date
    Nov 2007
    Location
    Monmouth, IL
    Posts
    379

    Re: How to save form data as csv

    I usually don't do work for free...
    1) I'm the only computer person in a 50 mil a yr company and I'm pressed for time right now to get this accounting system done by the first of the year
    2) i'm a firm believer in give a man a fish feed him for a day teach a man to fish and feed him for life

    you should do the research and learn it so when you need another script written you can do it yourself.... what i've given you is a file format to write the text file in and I've given you perl snipits on how to accept cgi post along with how to write text file... you just need to put it together to match your form... google has always been a developers best friend...
    Austin Mount
    AAS, A+, Compaq/HP APS
    austin@adrenlinerush.net

  7. #7
    jdaniels is offline x10Hosting Member jdaniels is an unknown quantity at this point
    Join Date
    Nov 2007
    Posts
    11

    Re: How to save form data as csv

    I agree with your sentiments. I work for a ridiculously sized company who for some reason are asking an amateur to do an experts job, whilst paying in gold bullion.

    I actually learn't HTML 10yrs ago, but things have moved on since then. I have been on google most of the day trying to sort this out, but will take your feedback and see if I can put it together to work for me.

    Thanks anyway

  8. #8
    HeavyMetalMan is offline x10Hosting Member HeavyMetalMan is an unknown quantity at this point
    Join Date
    Nov 2007
    Posts
    13

    Re: How to save form data as csv

    I'm having a similar problem, I get the e-mail from the form but can't create, write and append to a CSV file, I have the code from Netobjects. It can't seem to create the .csv file, where should I point it to (which folder)? I have it pointing to a folder with wide open permissions to be able to write.

    It goes to this page: http://heavymetalman.x10hosting.com/...ormHandler.php
    and get this error:
    An error occured. Please contact the site administrator.

    Error code: 500
    Thank you, I think I'm close but I need a little help!

  9. #9
    adrenlinerush's Avatar
    adrenlinerush is offline x10 Lieutenant adrenlinerush is an unknown quantity at this point
    Join Date
    Nov 2007
    Location
    Monmouth, IL
    Posts
    379

    Re: How to save form data as csv

    can you post the php?
    dinomirt96 likes this.
    Austin Mount
    AAS, A+, Compaq/HP APS
    austin@adrenlinerush.net

  10. #10
    HeavyMetalMan is offline x10Hosting Member HeavyMetalMan is an unknown quantity at this point
    Join Date
    Nov 2007
    Posts
    13

    Re: How to save form data as csv

    Hi, thanks. I finally got that working!

+ Reply to Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. Design a free form
    By gateway in forum Off Topic
    Replies: 1
    Last Post: 10-19-2007, 05:49 PM
  2. My php Form tutorial
    By WinGate in forum Tutorials
    Replies: 0
    Last Post: 08-20-2007, 08:14 PM
  3. Frontpage Form Problem
    By geek2009 in forum Scripts & 3rd Party Apps
    Replies: 2
    Last Post: 07-03-2007, 10:18 AM
  4. A simple Visual Basic Login Form
    By Zenax in forum Tutorials
    Replies: 0
    Last Post: 03-13-2007, 08:59 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers