James_Parsons Posted January 9, 2013 Share Posted January 9, 2013 (edited) 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 January 9, 2013 by James_Parsons Link to comment Share on other sites More sharing options...
jeffman Posted January 9, 2013 Share Posted January 9, 2013 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 More sharing options...
James_Parsons Posted January 9, 2013 Author Share Posted January 9, 2013 (edited) 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 January 9, 2013 by James_Parsons Link to comment Share on other sites More sharing options...
jeffman Posted January 9, 2013 Share Posted January 9, 2013 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. 1 Link to comment Share on other sites More sharing options...
jeffman Posted January 9, 2013 Share Posted January 9, 2013 Oh, yeah. You can save a script with a .cgi extension. No compiling. 1 Link to comment Share on other sites More sharing options...
James_Parsons Posted January 9, 2013 Author Share Posted January 9, 2013 thanks Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now