|
|
|
|
![]() ![]() |
Aug 5 2005, 10:36 AM
Post
#1
|
|
|
Desperately seeking "any key" to continue... ![]() Group: Admin Posts: 3,627 Joined: 23-April 05 From: Trap17 storage box Member No.: 6,042 myCENT:33.80 |
This tutorial is using TRAP17 hosting's built-in script called cgiemail. There are several hundreds of free scripts you can download and install it yourself but why not use what is already provided for you, if all you need is a simple submit and data collection?
Let's begin. There are three things you need to remember: 1) you can rename the file however you'd like 2) two files (which I'll name them submitForm.html and template.txt) must be in the same directory 3) first two lines in template.txt must EXIST. Write your submitForm.html (where you write a HTML page to let a visitor enter your desired information) and include the following (an example) HTML <form method="POST" action="http://name.trap17.com/cgi-bin/cgiemail/directory/template.txt" name="myform" > <input type="hidden" name="addendum" value="Thank you. If you are seeing this page, you should be contacted within 48 hours."> <table border=0 cellspacing=0 celpadding=0> <tr> <td colspan=2>Enter your information:<br> </td> </tr> <tr> <td><p align=right> First Name:</td> <td> <input type="text" name="FirstName" size=25 maxlength=50> <td> </tr> <tr> <td><p align=right> Last Name:</td> <td> <input type="text" name="LastName" size=25 maxlength=50> </td> </tr> <tr> <td><p align=right> Zip Code:</td> <td> <input type="text" name="zip" size=25 maxlength=50> </td> </tr> <tr> <td><p align=right> Email:</td> <td> <input type="text" name="email" size=25 maxlength=50> </td> </tr> <tr> <td><p align=right> Phone:</td> <td> <input type="text" name="area" size=4 maxlength=5>- <input type="text" name="exchange" size=4 maxlength=3>- <input type="text" name="number" size=5 maxlength=4> </td> </tr> ---------- Edit: Thank you midnightvamp. I have completely forgotten the most important code for sending. Please don't forget to include this at the bottom of your form code QUOTE(midnightvamp) To add a submit button to the form (so the people can send it once it's filled out), you would type this at the bottom... The discussion is also continued here http://www.trap17.com/forums/index.php?sho...ndpost&p=179049CODE <INPUT TYPE="submit" value="Send"> You might also want a 'reset' button: CODE <INPUT TYPE="reset" value="Reset"> And I believe that you must add a line to end the code for the form too at the bottom: CODE </form> ---------- It is not important how this HTML is written but that name="value" is assigned as you would like. Method must be ="POST"and ACTION="http...yoursite.trap17.com/cgi-bin/cgiemail/directory/template.txt" directory is optional, you can have this in your root or under another subfolder. Watch the template.txt spelling and they are case sensitive. Now write your template.txt as follows CODE To: your-receiving-address@server.com Subject: testing out the application form Name entered: [FirstName] [LastName] Zip code: [zip] Sender's email: [email] Sender's phone: ([area])[exchange]-[number] The first two lines are MUST! The way this cgiemail was written it looks for the first two lines for the execution. You can change them however you see fit but they must have To: and Subject: as listed above. And as you can see, I have my TXT file tab and spaced out as I'd like to see the final result. When you test out the form you will receive, either as attached TXT file or as a body of a letter (my yahoo account shows me both) CODE Name entered: Buffalo HELP Zip code: 90210 Sender's email: sender's@entered.email Sender's phone: (714)555-1212 When you receive this submitted data, you'll noticed that it's from some unknown email address (I won't type it here since it's against posting someone else's email address). That address is from the creator of this cgiemail file. That's why I have the visitor enter his/her address so that I have a record of the reply. It's not perfect but it works beautifully. I'll be sure to site the original source once I find the link again (I forgot where I put that thing) Cross post with question: http://www.trap17.com/forums/help-reading-files-t25623.html Edit: Found the original source located in cPanel CGI center > CGI Email http://web.mit.edu/wwwdev/cgiemail/user.html http://web.mit.edu/wwwdev/cgiemail/webmaster.html#test This post has been edited by BuffaloHELP: Aug 27 2005, 07:16 PM |
|
|
|
Aug 5 2005, 11:17 AM
Post
#2
|
|
|
Administrator ![]() Group: Admin Posts: 1,555 Joined: 11-June 04 From: Somewhere in Time & Space. Member No.: 1 myCENT:97.31 |
Cool thank.. Cgi Formmail tutorial will definately prove to be helpful for the members
|
|
|
|
Aug 5 2005, 11:30 AM
Post
#3
|
|
|
Desperately seeking "any key" to continue... ![]() Group: Admin Posts: 3,627 Joined: 23-April 05 From: Trap17 storage box Member No.: 6,042 myCENT:33.80 |
Forgot to explain this line:
HTML <input type="hidden" name="addendum" value="Thank you. If you are seeing this page, you should be contacted within 48 hours."> When you have this HTML, after a visitor submits the form the next page or redirect page will display the message, Thank you. If you are seeing this page, you should be contacted within 48 hours. If you know how to manipulate you can also have it redirect it to some other page with time delay. The possibilities are endless. |
|
|
|
Aug 5 2005, 03:51 PM
Post
#4
|
|
|
Member [Level 1] ![]() ![]() ![]() ![]() Group: Members Posts: 64 Joined: 4-August 05 From: Scottsdale, AZ Member No.: 10,314 |
Good tutorial. I figured I would ask here before anywhere else.
What exactly is CGI and what is it used for? I have seen it around alot but I have never used it beacuse of not knowing what it was. If someone could just tell me what it is in here, give me a link to a good site about it, or even make a tutorial about it, I would be very grateful. Anyway, good tut. |
|
|
|
Aug 7 2005, 04:19 AM
Post
#5
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 339 Joined: 2-December 04 From: Atlanta, GA Member No.: 2,516 |
Personally, I see it as a dumbed down version of PHP, for handling forms and advanced functions (however not as powerful as PHP)
Panda |
|
|
|
Aug 7 2005, 11:09 AM
Post
#6
|
|
|
Advanced Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 128 Joined: 6-August 05 Member No.: 10,402 |
Thanks. Even after reading this tutorial im not so good with forms,etc. My friend help's me with them most of the time =). Good tutorial though =D
|
|
|
|
Aug 27 2005, 06:05 PM
Post
#7
|
|
|
Desperately seeking "any key" to continue... ![]() Group: Admin Posts: 3,627 Joined: 23-April 05 From: Trap17 storage box Member No.: 6,042 myCENT:33.80 |
QUOTE(BlaqueMajik @ Aug 5 2005, 11:51 AM) What exactly is CGI and what is it used for? I have seen it around alot but I have never used it beacuse of not knowing what it was. Sorry to be off topic but CGI stands for QUOTE The common gateway interface (CGI) is a standard way for a Web server to pass a Web user's request to an application program and to receive data back to forward to the user. When the user requests a Web page (for example, by clicking on a highlighted word or entering a Web site address), the server sends back the requested page. However, when a user fills out a form on a Web page and sends it in, it usually needs to be processed by an application program. The Web server typically passes the form information to a small application program that processes the data and may send back a confirmation message. This method or convention for passing data back and forth between the server and the application is called the common gateway interface (CGI). It is part of the Web's Hypertext Transfer Protocol (HTTP). If you are creating a Web site and want a CGI application to get control, you specify the name of the application in the uniform resource locator (URL) that you code in an HTML file. This URL can be specified as part of the FORMS tags if you are creating a form. Go to google.com and type in the search field QUOTE define:cgi and look for this related meaning and links for Common Gateway Interface.Edit: For those who are looking to use this preinstalled script and have had trouble getting it to work, please check this thread http://www.trap17.com/forums/index.php?sho...ndpost&p=179014 Thank you This post has been edited by BuffaloHELP: Aug 27 2005, 08:52 PM |
|
|
|
Oct 12 2005, 07:40 PM
Post
#8
|
|
|
Never alone with Christ ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 646 Joined: 22-July 05 Member No.: 9,713 |
This is great, but I have a site that doesn't have cgiemail. Is there a way to hook up an html code with cgi to make it so it will send info to you without having the person to use their own email?
This way I could have people send their comments to me without having to use their email, but a comment area. |