Hi all.
i would like to ask, how to redirect to another page after user succesfully send their enquiry form?
the actionscript for the button is;
on (release) {
//Creates a LoadVars and get values from the form
mylv = new LoadVars();
myreply = new LoadVars();
mylv.email = email;
mylv.name = name;
mylv.occupational = occupational.selectedItem.data;
mylv.company = company;
mylv.address = address;
mylv.country = country.selectedItem.data;
mylv.zipcode = zipcode;
mylv.tel = tel;
mylv.fax = fax;
mylv.message = message;
mylv.recip = recip;
mylv.sics = sics.selected;
mylv.edu = edu.selected;
mylv.it = it.selected;
mylv.business = business.selected;
mylv.project = project.selected;
mylv.hr = hr.selected;
mylv.contactBy = contactBy.selectedItem.data;
//Show success or fails message
myreply.onLoad = function (success) {
if(!success)
_parent.status = 'sending failed';
else
_parent.status = this.status;
};
mylv.sendAndLoad('sendmail.php', myreply, 'POST');
_parent.status = 'sending now ...';
}
i try adding 1 line to the script (arrow), but if there's an error on the form which user need to correct their entry, it still will redirect it to the page.
myreply.onLoad = function (success) {
if(!success)
_parent.status = 'sending failed';
else
_parent.status = this.status;
_parent.gotoAndPlay(101); <------------------------------------------------------------------
};
}
the php code for this is form is
<?php
// list all vars to be expected from the movie
$vars = array("name", "occupational", "email", "message", "recip", "company", "address", "country", "zipcode", "tel", "fax", "contactBy");
// and import them into the script
foreach($vars as $var)
if(isset($_POST[$var]))
$$var = $_POST[$var];
else
$$var = '';
// check variables
if(strlen($name) < 3)
die("&status=please enter a real name&");
if(!eregi('^([a-z0-9\._-])+@([^\.]+\.[^\.]+)', $email, $matched))
die("&status=please enter a correct email address&");
else if(!getmxrr($matched[2], $mxrr))
die("&status=your mail server does not seem to exist&");
// where to send it
// remove or configure one of the two code blocks
$red = $_SERVER['/test/sf2/mailform.swf'];
// ***** or one fixed recipient ******
$recip = "admin@website.com";
//**** end fixed recipient *******
// build up message
// this code for any multiline text fields
$message = str_replace("\r", "\n", $message);
// info vars
$sender = $_SERVER[REMOTE_ADDR];
if($sics == 'true')
{
$sicsInfo = "Company Sdn. Bhd.";
}
else if($sics == 'false')
{
$sicsInfo = " ";
}
if($edu == 'true')
{
$eduInfo = "Education Consulting";
}
else if($edu == 'false')
{
$eduInfo = " ";
}
if($it == 'true')
{
$itInfo = "IT and E-learning Solution and Framework";
}
else if($it == 'false')
{
$itInfo = " ";
}
if($business == 'true')
{
$businessInfo = "Business Planning and Financial Forecasting";
}
else if($business == 'false')
{
$businessInfo = " ";
}
if($project == 'true')
{
$projectInfo = "Project Management";
}
else if($project == 'false')
{
$projectInfo = " ";
}
if($hr == 'true')
{
$hrInfo = "HR Strategic Management and Planning Services";
}
else if($hr == 'false')
{
$hrInfo = " ";
}
// you can rearrange this - just do not add or remove quotes
$mailbody = "Enquiry form sent by
Name: $name
Occupational: $occupational
Email: $email
Company: $company
Address: $address
Country: $country
Zip Code/Postal Code: $zipcode
tel: $tel
fax: $fax
I want to know information about:
$sicsInfo
$eduInfo
$itInfo
$businessInfo
$projectInfo
$hrInfo
Specific enquiry:
$message
How would you like to be contacted: $contactBy
-------
sender's ip: $sender";
// send it off
// note - if you omit the last part, a few servers do not send mail at all,
// but most would show strange senders like nobody@server17.hostingcompany.com
mail($recip, "Enquiry Form", $mailbody, "From: admin@webserver.com", $red);
// and tell visitor
print "&status=Enquiry sent - we will be in touch with you shortly&";
?>
How to redirect it to other page if the enquiry form succesfully send?
for your information, i follow and change code from flash-db e-mail tutorial. hopefully i post my problem in a right board.
thank you in advance.
-shamarque-