There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Software Development
Tag Cloud
audio blue screen boot bsod computer cpu crash dell desktop driver drivers error excel external hard drive firefox firewall format freezes freezing hard drive hardware hijackthis internet internet explorer itunes laptop malware motherboard mouse network networking outlook outlook 2007 power printer problem ram router screen slow sound trojan usb virus vista vista 32-bit windows windows xp winxp wireless
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Software & Hardware > Software Development >
PERL help! Need help creating CGI form script.


Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
sachit64's Avatar
Senior Member with 245 posts.
 
Join Date: Aug 2000
28-Sep-2003, 02:57 PM #1
PERL help! Need help creating CGI form script.
Alright, I'm totally new to PERL, yet my coop job at a hightech company requires me to make this one website page. I've never worked with scripts or buttons or anything on webpages, and I need help getting this started.

What I have to create is a page where employees can put their name, their ID number, and their department number.

There are fields the user fills out (Their name, their ID number, their department number ect..)

... and I need to add it into an TXT document with extra stuff.

So lets say those inputfields above are variables. I need it to show up like this in a txt document.

+name+"$"+departnumber+"$"To: "+name+ "("+idnum+")";

You know? Anyone willing to help?!?!?

-s64
Shadow2531's Avatar
Distinguished Member with 2,629 posts.
 
Join Date: Apr 2001
29-Sep-2003, 04:08 AM #2
I don't know how to write to a file in perl, but attached is an example of the form and the cgi script that takes the form varaibles and prints them out to the page.

In the loop you can change the print command to whatever command is need to print the variables to a file.

You might have to do some string replacement to replace any "+" with a space and something to delete trailing spaces.
You could also use javascript in the form.html to validate the form and get rid of any trail spaces and chekc that the deptnumber and ID number is valid.

The attached example should get you started.
Attached Files
File Type: txt example.txt (1.2 KB, 67 views)
__________________
10 ? "a line as the unending horizon"
20 ? "a curve as the rolling hillside"
30 ? "a point as a distant bird"
40 ? "a ray as the rising sun"
run
Shadow2531's Avatar
Distinguished Member with 2,629 posts.
 
Join Date: Apr 2001
29-Sep-2003, 04:29 AM #3
Attached is a new submit.cgi that creates a file called submit.txt. Each time info is submitted to it, it appends the info to the file.

It creates the file in the same directory as submit.cgi.

That should help you a little more.
Attached Files
File Type: txt writeexample.txt (355 Bytes, 62 views)

Last edited by Shadow2531 : 29-Sep-2003 04:34 AM.
sachit64's Avatar
Senior Member with 245 posts.
 
Join Date: Aug 2000
29-Sep-2003, 06:58 PM #4
Thank you soooo much! I'm sure this will help me along my way.
sachit64's Avatar
Senior Member with 245 posts.
 
Join Date: Aug 2000
08-Oct-2003, 11:25 PM #5
Well, there's a problem. Seems like they can't use CGI or PHP on this specific server and need it to be done in Visual Basics or Java.

I know Java the best out of any languages, but I only know applets, which I don't think they want. Anyone think they can just make a little HTML script that'll make the variables go into a text document?

http://www.geocities.com/sachit64/nortel.html

I need each of the fields which is a variable on it's own to be added to a txt document. Once you get that done, I'll be able to figure it out.

-s64
Gibble's Avatar
Distinguished Member with 27,137 posts.
 
Join Date: Oct 2001
Location: Striking or Scoring
Experience: The Alpha and Omega
09-Oct-2003, 11:30 AM #6
Well.

First, Java is far from the best language. And Visual Basic is not an internet programming language, unless you are referring to ASP.

HTML is only a markup language and can not write to a file.

So unless you can use a server side language like PHP, ASP, Perl, or Python, you won't be able to write that information into a textfile
__________________
izme: You know...it's kind of nice to sit atop Civilized debate and look down below on all of the uncivilized master debating we are here...just out of the fight zone

Gibble: Now you know what it's like to be Canadian.
khaki's Avatar
Distinguished Member with 2,433 posts.
 
Join Date: Jul 2003
09-Oct-2003, 12:09 PM #7
Quote:
Originally posted by sachit64:
Well, there's a problem. Seems like they can't use CGI or PHP on this specific server and need it to be done in Visual Basics or Java.

I know Java the best out of any languages, but I only know applets, which I don't think they want. Anyone think they can just make a little HTML script that'll make the variables go into a text document?

http://www.geocities.com/sachit64/nortel.html

I need each of the fields which is a variable on it's own to be added to a txt document. Once you get that done, I'll be able to figure it out.

-s64
If they are telling you that the server supports Visual Basic (by which I'm sure they actually mean VBScript)...
then you can do this in ASP.

It's very easy, actually.
Here is a great link where you can see it being used and where you can get the code that does it (and then all you have to do is modify and implement it into your page)

http://www.asp101.com/samples/textfile.asp

have fun!!!!
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 02:34 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.