Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Please can someone help me with a CGI mailform question

Status
Not open for further replies.

DougieMcN

Technical User
Sep 16, 2007
13
Hi, I have created a form with the intention of having the information e-mailed to myself. I have uploaded the cgi script to my providers cgi bin and when I check the url to the script in a browser address bar, don't receive any apparent errors in my browser.

The problem is I don't receive the information from the form either.

I have attached the actionscript (attached to the send button) for the form text fields as well as the cgi script I have uploaded to the server and would be grateful if someone could have a look at both scripts to see if I am missing the obvious. There is of course far more to the cgi script but as far as I can see I only require the fields at the top of the script for the minimal amount of information I require. I can post the remainder if it helps.

This is my first attempt at using a cgi/perl script so any help would be appreciated, I've also replaced domain names and e-mail addresses but they are correct in the proper cgi script/flash file.

Cheers.

Dougie.

<----actionscript attached to send button below------------>

stop();

var gatherForm:LoadVars = new LoadVars();

//--------------------------------------------------------------------------------\\

function sendForm()
{
gatherForm.visitor_name = fullName.text;
gatherForm.visitor_address = fullAddress.text;
gatherForm.visitor_postcode = postcode.text;
gatherForm.visitor_telNumber = telNumber.text;
gatherForm.email_address = emailAddress.text;
gatherForm.sendAndLoad(" "POST");

}

this.submitButton.onRelease = function()
{
if (fullName.text == "" || fullAddress.text == "" || postcode.text == "" || telNumber.text == "")
{
gotoAndStop("error");
}

else

{
sendForm();
gotoAndStop("correct");
}
}

------------<cgi script below>-------------

#!/usr/bin/perl

# Define Variables #
# Detailed Information Found In README File. #

# $mailprog defines the location of your sendmail program on your unix #
# system. The flags -i and -t should be passed to sendmail in order to #
# have it ignore single dots on a line and to read message for recipients #

$mailprog = /usr/lib/sendmail -i -t';

# @referers allows forms to be located only on servers which are defined #
# in this field. This security fix from the last version which allowed #
# anyone on any server to use your FormMail script on their web site. #

@referers = ('
# @recipients defines the e-mail addresses or domain names that e-mail can #
# be sent to. This must be filled in correctly to prevent SPAM and allow #
# valid addresses to receive e-mail. Read the documentation to find out how #
# this variable works!!! It is EXTREMELY IMPORTANT. #
@recipients = ('myemail@me.co.uk');

# ACCESS CONTROL FIX: Peter D. Thompson Yezek #
# @valid_ENV allows the sysadmin to define what environment variables can #
# be reported via the env_report directive. This was implemented to fix #
# the problem reported at #

@valid_ENV = ('REMOTE_HOST','REMOTE_ADDR','REMOTE_USER','HTTP_U SER_AGENT');

# Done
 
check the server error logs.

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
Thanks Kevin. May I gather from your reply there appears to be no apparent errors in my script.

Cheers.
 
I don't know actionscrip so I can't say, the perl code contains no "errors" but that's just some configuration stuff for the formmail script and may or may not be correct for your situation. I assume stuff like this has your real data written in:

@referers = ('
------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
are you using CGI module if so, do you have

use CGI ('fatalsToBrowser'); this can help display errors on the browser, or like Kevin stated check the server logs.
 
Thanks max1x,

bacause I am new to CGI I have to honestly say I am not really sure what the CGI module is.

My latest attempt to get to form working is to change to actionscript in the sendAndLoud conditions on the send button to:

function sendForm()
{
gatherForm.visitor_name = fullName.text;
gatherForm.visitor_address = fullAddress.text;
gatherForm.visitor_postcode = postcode.text;
gatherForm.visitor_telNumber = telNumber.text;
gatherForm.email_address = emailAddress.text;
gatherForm.sendAndLoad(" gatherForm, method="POST");

}

this.submitButton.onRelease = function()
{
if (fullName.text == "" || fullAddress.text == "" || postcode.text == "" || telNumber.text == "")
{
gotoAndStop("error");
}

else

{
sendForm();
gotoAndStop("correct");
}
}

I am using the newer NMS cgi form but am getting stuck with the get POST error if anyone can offer any help thanks.
 
see the other forum where you have this question posted.

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top