1. 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.

PERL help! Need help creating CGI form script.

Discussion in 'Software Development' started by sachit64, Sep 28, 2003.

Thread Status:
Not open for further replies.
Advertisement
  1. sachit64

    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
     
  2. Shadow2531

    Shadow2531

    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.
     

    Attached Files:

  3. Shadow2531

    Shadow2531

    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.
     

    Attached Files:

  4. sachit64

    sachit64 Thread Starter

    Joined:
    Aug 3, 2000
    Messages:
    245
    Thank you soooo much! I'm sure this will help me along my way.
     
  5. sachit64

    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
     
  6. Gibble

    Gibble

    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
     
  7. khaki

    khaki

    Joined:
    Jul 26, 2003
    Messages:
    2,431
    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!!!! :)
     
  8. Sponsor

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 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/168080

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice