bustergrimes
01-25-2007, 10:53 AM
Hi, I am trying to create a Flash form that will capture a few details then send them to me via a CGI script once submited.
Below is the code I have already, that sits in the first frame of my Flash file:
function sendMail() {
_form = new LoadVars();
_form.recipient = 'chris@mypeter.com';
_form.COMMENTS = comments;
_form.PHONE = phone;
_form.POSTCODE = postcode;
_form.COUNTY = county;
_form.TOWN = town;
_form.ADDRESS2 = address2;
_form.ADDRESS1 = address1;
_form.SHOP = shop;
_form.EMAIL = email;
_form.NAME = name;
_form.subject = 'New Villa Enquirey';
_form.realname = 'A potential new customer';
_form.onLoad = formDone;
_form.sendAndLoad('http://www.easternalgarvevillas.com/cgi-admin/FormMail.pl',_form,"GET");
}
function formDone(success) {
// Confirms if it has been sent to the srcipt
info = success;
trace(success);
}
And this is the code I have on my 'submit' button:
on (release) {
if (!name.length) {
error = 1;
}
if (!email.length) {
error = 1;
}
if (email.length) {
if (email.indexOf("@") == -1 || email.indexOf(".") == -1) {
error = 2;
}
}
if (!tel.length) {
error = 1;
}
if (!error == 1) {
if (!comments.length && mailinglist == "no") {
error = 3;
}
}
if (error == 1) {
gotoAndStop("Error1");
}
if (error == 2) {
gotoAndStop("Error2");
}
if (error == 3) {
gotoAndStop("Error3");
}
if (error == 0) {
gotoAndStop("thanks");
// This is meant to send an email to chris@mypeter.com
// But it needs to be on the server which u set up @referers in the cgi
sendMail();
}
}
I have managed to use this code and get it working before, but not being very good at coding (I'm a designer) I believe that I've forgetten something. I think I need to have a Perl file called 'FormMail.pl' that sits on the server here in the place I have specified (http://www.easternalgarvevillas.com/cgi-admin/FormMail.pl) containing the script that makes this all this work
Is this right? If so can anyone help me out with a Perl file that I can put on the server to make this thing work? If not, can anyone please tell me what I need to do?
Thanks in advance.
Below is the code I have already, that sits in the first frame of my Flash file:
function sendMail() {
_form = new LoadVars();
_form.recipient = 'chris@mypeter.com';
_form.COMMENTS = comments;
_form.PHONE = phone;
_form.POSTCODE = postcode;
_form.COUNTY = county;
_form.TOWN = town;
_form.ADDRESS2 = address2;
_form.ADDRESS1 = address1;
_form.SHOP = shop;
_form.EMAIL = email;
_form.NAME = name;
_form.subject = 'New Villa Enquirey';
_form.realname = 'A potential new customer';
_form.onLoad = formDone;
_form.sendAndLoad('http://www.easternalgarvevillas.com/cgi-admin/FormMail.pl',_form,"GET");
}
function formDone(success) {
// Confirms if it has been sent to the srcipt
info = success;
trace(success);
}
And this is the code I have on my 'submit' button:
on (release) {
if (!name.length) {
error = 1;
}
if (!email.length) {
error = 1;
}
if (email.length) {
if (email.indexOf("@") == -1 || email.indexOf(".") == -1) {
error = 2;
}
}
if (!tel.length) {
error = 1;
}
if (!error == 1) {
if (!comments.length && mailinglist == "no") {
error = 3;
}
}
if (error == 1) {
gotoAndStop("Error1");
}
if (error == 2) {
gotoAndStop("Error2");
}
if (error == 3) {
gotoAndStop("Error3");
}
if (error == 0) {
gotoAndStop("thanks");
// This is meant to send an email to chris@mypeter.com
// But it needs to be on the server which u set up @referers in the cgi
sendMail();
}
}
I have managed to use this code and get it working before, but not being very good at coding (I'm a designer) I believe that I've forgetten something. I think I need to have a Perl file called 'FormMail.pl' that sits on the server here in the place I have specified (http://www.easternalgarvevillas.com/cgi-admin/FormMail.pl) containing the script that makes this all this work
Is this right? If so can anyone help me out with a Perl file that I can put on the server to make this thing work? If not, can anyone please tell me what I need to do?
Thanks in advance.