PERL help! Need help creating CGI form script.

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

sachit64

Thread Starter
Joined
Aug 3, 2000
Messages
245
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
 
Joined
Apr 30, 2001
Messages
2,636
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.
 

Attachments

Joined
Apr 30, 2001
Messages
2,636
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.
 

Attachments

sachit64

Thread Starter
Joined
Aug 3, 2000
Messages
245
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
 
Joined
Oct 9, 2001
Messages
27,087
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
 
Joined
Jul 26, 2003
Messages
2,431
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!!!! :)
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Top