Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Website Design Forum


You are currently viewing our Website Design Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Is there a CGI script to output form entries to a text document?
Old 01-12-2007, 06:15 AM Is there a CGI script to output form entries to a text document?
Novice Talker

Posts: 14
Name: Matthew Laver
Trades: 0
I am creating a html form that will appear on a localhost site i.e. there will be no internet connection. This form is intended to take contact details from people visiting me at a display.

Once the visitors have entered the details and pressed submit I would like their entries to be stored as a new .txt document ( or even better added to a csv file but I appreciate this may be a bit tricky).

Does anyone have any suggestions on how to proceed? Any help would be great.

Thanks
Mr Batman is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-12-2007, 02:29 PM Re: Is there a CGI script to output form entries to a text document?
blue-dreamer's Avatar
King Spam Talker

Posts: 1,222
Location: Middle England
Trades: 0
You could use MS Excel/Access to do this. Create your spreadsheet/database and an input form then any records you add will be stored (don't forget to save the file regularly!). You can then export the data into a CSV file.
blue-dreamer is offline
Reply With Quote
View Public Profile
 
Old 01-15-2007, 05:23 AM Re: Is there a CGI script to output form entries to a text document?
Novice Talker

Posts: 14
Name: Matthew Laver
Trades: 0
Yeh I hadn't thought of that - I really would like it to come from a html based form though. Is there a way of exporting form info into an excel file on a local machine?
Mr Batman is offline
Reply With Quote
View Public Profile
 
Old 01-16-2007, 08:50 PM Re: Is there a CGI script to output form entries to a text document?
Novice Talker

Posts: 7
Name: Evan
Trades: 0
I can help.

First, get cgi-lib.
Then, you need to make the cgi file to process the form.

Put the cgi file in the same directory as the cgi-lib.pl file.

Then, put these lines in the beginning of the cgi file.
Code:
#!/usr/bin/perl
require "cgi-lib.pl";
&ReadParse(*input);
Now, for each form input, put a line with each input name.

Here, the input names are username and password.

Code:
$username = $input{'username'};
$password = $input{'password'};
Then, put lines like this to open the file

Code:
open(OUT, users.txt);
select(OUT);
The, write to the file

Code:
print "Username: $username";
print "Password: $password";
print "\n===========================\n\n";
Finally, add

Code:
close(OUT);
I hope this helped. You would probably want to add a redirect of some sort, or just have a link back to the main form with a thank you message.
GreyFox is offline
Reply With Quote
View Public Profile
 
Old 01-17-2007, 05:51 PM Re: Is there a CGI script to output form entries to a text document?
Novice Talker

Posts: 14
Name: Matthew Laver
Trades: 0
Thanks sounds very concise - I will give it a go tomorrow and let you know if it works.
Mr Batman is offline
Reply With Quote
View Public Profile
 
Old 01-19-2007, 11:57 PM Re: Is there a CGI script to output form entries to a text document?
Novice Talker

Posts: 7
Name: Evan
Trades: 0
So, how goes this? Did it work?
GreyFox is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Is there a CGI script to output form entries to a text document?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.41595 seconds with 12 queries