Setting Up A Form Powered By CGI

Note: For this tutorial, you must have a server that allows Perl CGI (Common Gateway Interface) scripts.

You will need to have a Perl module called installed for this form to work. If you have telnet access, you can type "which" and it should tell you where it is or if you have it. If you don’t have telnet access, you can use another CGI script to check for it. To check and see if this is already installed using another CGI script, create a Perl script that looks like this:


# – my first perl script!

use CGI;

print "Hello, world!n";

The first line should be set to the location of Perl on your server. You have to chmod this script 755. If the page says "Hello, world!" then you already have it installed, but if you get an error, then you don’t. To learn how to install it, go to This Site. Once you install it, you can continue.

Now, you will need to download the CGI script and the thanks file. Click here to download the file. Open up the file "mailaform.cgi" in your text editor.

Ok, the very first line of the script should be set to the location of Perl. Leave the "-w" at the end of it. The sendmail variable should be the path to sendmail on your server. $recipient should be your email address or whomever is going to be receiving the email. Now for $sender and $subject. The sender should be the name you want all of the forms to be from and subject should be the subject of the email.

The last variable you need to edit is $thanks, which is the location to the file "thanks.txt." this would be the file thanking them for using your form. It should contain HTML, but still be saved as a text(.txt) file. You should upload this file and chmod it 777.

Now, all you have to do to finish editing the script is upload "mailaform.cgi" to your cgi-bin and chmod it 755.
To use the script, make a regular form, but instead of "<FORM>", use this line to start it: <FORM ACTION="" METHOD="POST">


Category: perl Time: 2001-03-15 Views: 2

Related post

  • Set custom upload form for specific document library 2013-12-05

    How to set custom upload form for existing specific document library in sharepoint using visual studio? --------------Solutions------------- A custom aspx page would be possible though,but editing the OOTB upload.aspx in the 14 hive would make your e

  • Can't set options on form ajax callback 2014-09-19

    I have created a custom form in a custom page in the admin of my Drupal 7 site. On this form I have two sets of radio buttons (cities and sectors). I want it so that when I change the cities radio selection, the sector radio values swap to my new set

  • Is it possible to set a (hidden form field) " input type='hidden' name='test_field_name'/ " with PHP? 2016-03-15

    I'm trying to figure out a way to set a hidden form field value using PHP. I've tried using: $_POST['test_field_name'] = "some value"; When I submit the form, the form handler doesn't "see" the form value. ie (the following doesn't wor

  • Setting up a solar-powered ad-hoc network? 2012-01-17

    I was intrigued for the idea of a darknet, as seen all over certain reddit subreddits, and was developed an idea in my head that I need some help to figure out. Is it possible to set up an ad-hoc network with wireless signal extenders so that every c

  • Change Default PHP Setting to PHP-FPM from Fast-CGI 2015-01-02

    I searched the forums and could not find an answer to this. I'm brand new to ISPConfig and got it up and running great with multiple PHP versions. I want to change the default PHP type to php-fpm so whenever I add a new site it will use that instead

  • value not set in contact form 7 plugin of wordpress 2012-01-20

    i'm using contact form 7 plugin in wordpress, i have generate text field like this: [textarea your-message 25x3 "<?php print_r($_POST); ?>"] i have to set value of input name which comes from another form with POST method. but it's not wor

  • SafeCracker - display radio and checkbox? set class in form ? wrap hidden fields in fieldset ? 2012-12-15

    My Channel has radios and checkboxes. How to I loop through the options so that I can display each item as a radio/checkbox option in the mark up? The example I found doesn't make much sense to me: {if radio} {options} <label class="checkbox"

  • Set InfoPath 2010 form to grade mulitiple choice 2013-05-10

    I have set up an InfoPath 2010 form with drop-down list answers that I changed to radio buttons. When a selection is made and submitted, the answer(ID) is sent to a SharePoint 2010 list. My question is how would I create a rule or formula to grade ea

  • "The controlmode control form has not been set" on Display Form 2013-05-29

    I created a Display Form on a Custom List that have a rating column, but when I open this form with a user that is a non administrator, this error is show: "The controlmode control form has not been set" Someone can help me? Thanks!!! ----------

  • Secure Forms setting and Ajaxified Forms 2013-08-13

    As I discovered, it seems that "Secure Forms" setting won't allow anyone to submit more than once in Ajax. I researched about this and I found out that it was because you can't send a form with same XID twice. You need to reload the page to get

  • How to set value in form validate for later validation functions 2014-02-21

    Problem I'm adding the user register form onto the node create form with hook_form_alter. The problem is the first step of account validation always fails because Drupal doesn't save Username to form_state['values']['name']. (I think because I'm comb

  • how to alter only one set of specific forms? 2014-11-17

    Consider I have 3 content type. The problem is that if I use form alter in a module , when I use: drupal_set_message(t($form_id), 'status', FALSE); in the mentioned hook, it shows me different set of form-IDs as message on showing each node add/edit

  • Is there a global setting for number form 2015-01-28

    I'm creating strings which represent equations in C to use with library link. The problem I have is that numbers in ScientificForm are no longer useful after they are converted to strings. For example, 2.77778*10^11 becomes 11 2.77778 10 So is there

  • how to set per site php mode (mod_php5, cgi, fastcgi) in apache 2015-02-27

    i have 3 sites which are stored in /etc/httpd/conf.d/ site1.conf site2.conf site3.conf here's one <VirtualHost *:80> ServerName ServerAlias DocumentRoot /var/www/vitalii/ <Directory /var/www/vitalii/> Orde

  • Custom Display Set as Default Form Not Working 2015-03-16

    In SPD 2013 I created a custom display form "New" and set it up as the default form for the selected type. However, when I'm in SharePoint and I select an item, it takes me back to the old default display form "DispForm". Is there any

  • Setting up Cognito Form to use a template to handle registration for multiple events 2015-08-19

    I want to setup a single registration form template for multiple events. Can you use the same form template for multiple events and show specific data for each event - as participants register? I want to be able to get specific data for the event so

  • How to set name in form without name:? 2016-02-05

    I'd like to create a <form> tag like below: <form accept-charset="UTF-8" action="/login" method="post" name="login_form"> As the online document in s

  • How do I find or set the apropriate form for base scheme fields? 2016-02-10

    In my custom entity I want to set a base scheme field, which is an integer. The field has a minimum of 0, a maximum of 360 and a default of 180. I tried this so: $fields['pan'] = BaseFieldDefinition::create('integer') ->setLabel(t('PAN')) ->setDescr

  • How can I set a Google Forms survey to read-only? 2016-03-06

    I finished the collection of responses through a Google Form. Now I want to set the survey to read-only, i.e. allowing people to view the form but not submit any more responses.

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development


Front-end development


development tools

Open Platform

Javascript development

.NET development

cloud computing


Copyright (C), All Rights Reserved.

processed in 2.107 (s). 13 q(s)