Jump to content

Perl POST HTML Form


James_Parsons

Recommended Posts

Hello. I am beginning per for cgi scripting. I have been trying to find out how to do a simple form POST. I want it to take the info from a textbox and then write it to a file called info.txt. Every POST example I have found is too complicated. Please tell me if GET would be better suited for this. I just want someone to teach me how. Here is an example html file: example.htm

<!DOCTYPE html><html><head>  <title>POST Example</title></head><body><form name="example" method="POST" action="ThePerlFile">   <input type="text" name="value" />   <input type="submit" name="submit" value="Submit It"/></form></body></html>

Edited by James_Parsons
Link to comment
Share on other sites

You forgot the file. GET should be used only to request data, not to upload data. Anyway, the technique would be the same. If you're discussing the server side, the examples are complicated because PERL is poorly suited to this stuff. It was not designed for it. It was designed for scripting tasks on a Unix workstation. It was the standard for server-side scripting in the early years because it worked and other, better scripting languages had not yet been developed. If you have a choice I'd recommend learning PHP instead. It was actually designed for server-side scripting, and it is widely used. So. Do you really want to ask about Perl? Can you ask a more specific question? If you're having troubles with the HTML form, that's a different set of questions.

Link to comment
Share on other sites

I just want to know how to retrieve form data from perl and then write it to a file. I honestly don't care about the complexity. I'm not even planning to host any sites quite yet. I forgot to ask if my perl file could be kept as a .pl or do I have to compile it to a .cgi or somthing

Edited by James_Parsons
Link to comment
Share on other sites

I suggest looking at the CGI Perl Module here, where you will find all the documentation and a link to the source at the top. It simplifies a lot of tasks we used to code by hand, but I would not call it intuitive. There is a beginner's guide to using it here. You'll appreciate the very simple form example 2-3 screens down.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...