Webhosting Promotion Submission Virtual Server Servers Web Design Web Graphic Design Internet Marketing Bulletin Boards BBS sysop webhosting secure
Moving Sites

Connection Help

Forms Help

Advanced Forms
Help


SSI Help

My SQL help

PHP help



Front Page
Frontpage FAQ

Frontpage
Tutorial


Page 1

Page 2

Page 3


Help Home

Opt2 Home




Using Opt2.net's FormCGI script

FormCGI takes form input and emails you or writes out to a file, or both. FormCGI is a more flexible replacement for our Mailform and Fileform scripts.

Sample Form processor:

    Topping:
    Extra cheese?
    Destination email address:


    When the submit button is pressed (above), Opt2.net's form.cgi script emails the form input (information about the topping and extra cheese) to the destination email address or writes out to a designated file (or both) . The destination email address can either be user-specified (as above), or hard-coded. You may also have this information written out to a file instead of being emailed.

    Try the form above! You should receive an email which looks something like this:

      Below is the result of your feedback form. It was submitted by Sample form (sample@Opt2.net.com) on Sunday, July 6, 1997 at 01:59:57 ------------------ topping: Pepperoni extra_cheese: on ------------------ Date: Sun Jul 6 01:59:57 1997 IP: 204.210.0.22 Referrer: http://customers.Opt2.net.com/free_cgi/formcgi.shtml Server: customers.Opt2.net.com

    The code to produce the form above:

    <FONT SIZE=+1><B>Sample Form processor:</B></FONT><BR>
      <FORM METHOD=POST ACTION="/cgi-t/form.cgi">
      Destination email address: <INPUT TYPE=TEXT NAME=to><BR>
      <INPUT TYPE=HIDDEN NAME=from VALUE="sample@Opt2.net.com">
      <HR SIZE=1>
      Topping: <SELECT NAME=topping>
         <OPTION> Pepperoni
         <OPTION> Mushroom
         <OPTION> Anchovies
      </SELECT><BR>
      Extra cheese? <INPUT TYPE=CHECKBOX NAME=extra_cheese><BR>
      <INPUT TYPE=HIDDEN NAME=realname VALUE="Sample form">
      <INPUT TYPE=SUBMIT VALUE="Submit this form!">
    <HR SIZE=1>
    </FORM>


Using FormCGI to email results:

    Using form.cgi is straightforward. Simply use the following code fragment, and build your form and HTML around it:

    <FORM METHOD=POST ACTION="/cgi-t/form.cgi">

      <INPUT TYPE=HIDDEN NAME=to VALUE="you@yourdomain.com">
      <INPUT TYPE=HIDDEN NAME=from VALUE="you@yourdomain.com">
      <INPUT TYPE=HIDDEN NAME=subject VALUE="My subject goes here">

       {place your form elements here}

      <INPUT TYPE=SUBMIT VALUE="Submit this form!">
    </FORM>

    You must specify "to" and "from" email addresses, replace "you@yourdomain.com" with your actual email address, and select any subject which you like to replace "My subject goes here".

Using FormCGI to write results to a file:

    Use the following code fragment if you want to have the results of your form written to a file instead of being emailed to you:

    <FORM METHOD=POST ACTION="/cgi-t/form.cgi">

      <input type=hidden name="filename" value="XXX">

       {place your form elements here}

      <INPUT TYPE=SUBMIT VALUE="Submit this form!">
    </FORM>

    Replace "XXX" with a name that you would like to use. The results will be written out to a file named "XXX.fileform.txt", this file will appear in your /cgi-out which is located up one directory from your /htdocs (default webroot) directory.

    If you would like to be notified when a submission has been placed in the file, add the following line:

    <input type=hidden name="notifyto" value="you@yourdomain.com">

    Replace "you@yourdomain.com" with your email address. You will then receive an email letting you know that you have a submission, however the actual data submitted will only be written to the file.



The above documentation should serve as an introduction to the form.cgi script, and provide you with enough information to setup and try out your first form. Click here for advanced forms.