Graphic Design Forum and Web Design Forum

Compare Web Hosting


Go Back   Graphic Design Forum and Web Design Forum »Web Design Forum »Programming Forum

Notices

Programming Forum Web and Software Programming Forum - Java, PHP, SQL etc.


Reply
 
LinkBack (1) Thread Tools Display Modes
  1 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 30-12-2008, 12:14 AM
likethegoddess's Avatar
Idiosyncratic Member ;)
 
Join Date: May 2008
Location: San Francisco, Calif.
Gender: Female
Posts: 693
Default Form to CSV recommendation sought

I'm working with an existing Formmail script and trying to get multiple messages to port to a single file. In this case, sending the name, email, location, etc. fields for each sender to a single .csv file.

Any recommendations?
____________________________

likethegoddess design for musicians and non-profits
Twitter | RSS | Google Reader | Facebook | Flickr | Pandora | Last.fm
Digg this Post!Add Post to del.icio.usBookmark Post in Technorati Share This Article & VoteReddit! Wong this Post!Stumble this Post!RSS Share on FacebookForum Netvibes PageTwit this!
Reply With Quote

  #3 (permalink)  
Old 31-12-2008, 04:11 PM
likethegoddess's Avatar
Idiosyncratic Member ;)
 
Join Date: May 2008
Location: San Francisco, Calif.
Gender: Female
Posts: 693
Default

Hey, thanks, toon. I'll check it out.
____________________________

likethegoddess design for musicians and non-profits
Twitter | RSS | Google Reader | Facebook | Flickr | Pandora | Last.fm
Digg this Post!Add Post to del.icio.usBookmark Post in Technorati Share This Article & VoteReddit! Wong this Post!Stumble this Post!RSS Share on FacebookForum Netvibes PageTwit this!
Reply With Quote
  #4 (permalink)  
Old 31-12-2008, 05:14 PM
likethegoddess's Avatar
Idiosyncratic Member ;)
 
Join Date: May 2008
Location: San Francisco, Calif.
Gender: Female
Posts: 693
Default

Ah. They start off talking about db solutions, but move on to attached csv files. I need to collect data at a single source that's exportable in csv format rather than getting a csv file for each email. Sorry if I was unclear.
____________________________

likethegoddess design for musicians and non-profits
Twitter | RSS | Google Reader | Facebook | Flickr | Pandora | Last.fm
Digg this Post!Add Post to del.icio.usBookmark Post in Technorati Share This Article & VoteReddit! Wong this Post!Stumble this Post!RSS Share on FacebookForum Netvibes PageTwit this!
Reply With Quote
  #5 (permalink)  
Old 31-12-2008, 05:40 PM
sionnach's Avatar
foxing the web
 
Join Date: Aug 2008
Location: Cambridge, UK
Gender: Male
Posts: 1,592
Default

I'm not sure what Formmail is, but if you explain a small bit clearer what you want I might be able to help. Where would the source of the emails be coming from? Does the data already exist and if so, where?
Digg this Post!Add Post to del.icio.usBookmark Post in Technorati Share This Article & VoteReddit! Wong this Post!Stumble this Post!RSS Share on FacebookForum Netvibes PageTwit this!
Reply With Quote
  #6 (permalink)  
Old 31-12-2008, 06:34 PM
likethegoddess's Avatar
Idiosyncratic Member ;)
 
Join Date: May 2008
Location: San Francisco, Calif.
Gender: Female
Posts: 693
Default

Ah, I'm working a contact form on a website. The contact form is an extensive questionnaire, really, with information submitted by the website user. I need to collect that data into one file, which may be a database. The data needs to export to csv so that the basic contact info (name, email, etc.) can be stripped out and uploaded to an email list. Does that make sense?
____________________________

likethegoddess design for musicians and non-profits
Twitter | RSS | Google Reader | Facebook | Flickr | Pandora | Last.fm
Digg this Post!Add Post to del.icio.usBookmark Post in Technorati Share This Article & VoteReddit! Wong this Post!Stumble this Post!RSS Share on FacebookForum Netvibes PageTwit this!
Reply With Quote
  #7 (permalink)  
Old 31-12-2008, 07:25 PM
vdowsett's Avatar
Dowsett Designs
 
Join Date: Mar 2008
Location: Overland Park, Kansas
Gender: Female
Posts: 905
Default

Can you set up a MySQL database, and have the form submit to that?
Digg this Post!Add Post to del.icio.usBookmark Post in Technorati Share This Article & VoteReddit! Wong this Post!Stumble this Post!RSS Share on FacebookForum Netvibes PageTwit this!
Reply With Quote
  #8 (permalink)  
Old 02-01-2009, 04:23 PM
Scriptage's Avatar
Design Guru
 
Join Date: May 2008
Location: The People's Republic of Yorkshire
Gender: Male
Posts: 1,946
Default

Code:
#!/usr/bin/perl -w
use strict;
use URI::Escape;
use Fcntl qw(:flock);
use CGI qw(:all); # Export all CGI functions into the current package
my @variables = qw(name email comments);
my $csv_file = "comments.csv";
sub printPage{
my $message = shift;
print<<EOF;
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html 
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>PERL Form</title>
<link rel="stylesheet" href="index.css" media="screen" />
</head>
<body>
$message
</body>
</html>
EOF
exit(0);
}
##################################################################################################################
print header;
my ($output, $sem);
   foreach my $item(@variables){
   printPage("We were unable to process your comments due to the omission of '$item'") unless defined param($item);
   $output .= uri_escape(param($item)) . ",";
   }
open(my $fh, ">>$csv_file") || die "Coulod not open comments.csv: $!";
print $fh substr($output, 0, length($output)-1) . "\n";
close($fh);
printPage("Thank you for your comments.");
 

sub get_lock{
open($sem, ">semaphore.sem") || die "Could not create semaphore file: $!";
flock($sem, LOCK_EX) || die "Lock failed: $!";
}
sub release_lock{
close($sem);
}
That should do the trick, all you need to do is change (or add to) the variable names in @variables (the names of your form items) and the name of your csv file.

The output is URI escaped so you won't get input such as "Hi, my name is John" affecting the comma seperation in your CSV file.

Any questions just ask.

Regards

Carl

Last edited by Scriptage; 02-01-2009 at 04:28 PM. Reason: Disappearing HTML
Digg this Post!Add Post to del.icio.usBookmark Post in Technorati Share This Article & VoteReddit! Wong this Post!Stumble this Post!RSS Share on FacebookForum Netvibes PageTwit this!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



Similar Threads
Thread Thread Starter Forum Replies Last Post
Movie recommendation service PR Design Off Topic 2 06-11-2008 02:38 PM
How to create a form????? PosterManiac General Web Design Forum 3 17-05-2008 02:44 PM
PHP Form ohio CSS Forum 3 06-12-2007 12:53 AM
Mobile/Web Designer Sought For London-Based Social Networking Application Snappl Design Forum Employment 0 16-11-2007 07:45 AM
Form Help drewbie_wan Programming Forum 1 07-09-2007 08:32 AM



The Graphics Forum Web Design Stuff Free Decent Downloads Free Quality Wallpapers Graphics Forum
Free Vista Themes Creativecurio - Design Blog Graphic Design Advertising Graphic Design Advertising
The Top The Best Images Heavenly Glimpses Photography Tech Talk 247 Logo Design - $149 Affordable Stock Vector Illustrations
Free Design Portfolios

Create your own custom 2010 Calendars

Web Hosting - UK Web Hosting services for business or personal website hosting needs.

Dedicated Servers - A full range of Managed Dedicated Server solutions suitable for all your requirements.

Graphic Design Blog | Web Design Forum | Graphic Design and Print Forum | Graphic Design Links | Advertise On This Site

Web Design UK | Design by Miner Skinz.com | Logo Design UK | Art Schools Online | Pressure Seal Printing | Vision.To Design

Colour Print | Graphic Design UK | Logo Design | Photography Blog | Brochure Design UK | Design Forum Links | Logo Design

Graphic Design Schools Online | Integrated Cards | Integrated Labels | Graphic Design | Logo Design | Graphic Design Social Network

Logo Design | Integrated Cards & Labels | Graphic Design Tutorials | Logo Designer | UK Logo Design Studio

Colour Printers, Web Design and Logo Design UK | Business Cards | Accident and Injury Claims Rotherham UK | Logo Design Blog

Funfair Hire, Carousel Hire, Carnival Hire in the UK | Web Designer Rotherham, Yorkshire, UK | Damp Proofing & Plastering, Dartford, Kent

Damp Proofing, Refurbishment & Plastering, London | Wedding Photography London, Wedding Photographer, Kent

Free Dating in Sheffield | Free Dating in Sheffield and Yorkshire Forum | Motorhome Rental and RV Hire Scotland | Vector Art Blog

Free Web Hosting | Custom Logo Design - $149 Only | Affordable Print Design Templates | Small Business Logo Design | Company Logo Design

Logo Design Service | Logo Design Firm | Logo Design Reseller | Custom Logo Design | Letterhead Printing | Flyer Printing | Business Card Printing

All times are GMT. The time now is 10:17 PM.


Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 Estetica Design Forum's Privacy Policy