I am trying my hand at AS and PHP as I have mentioned in previous posts. I have followed the tuts and find them really helpful. The PHP used was enlarged from a Senocular tut (not too sure whether it works though) and is:
<?php
$sendTo = "estimate@kiereen.com";
$subject = "Estimate enquiry";
$headers = "From: " . $_POST["contact"];
$headers .= "<" . $_POST["emailAddress"] .">
";
$headers .= "Contact method: " . $_POST["replyBy"] .">
";
// this instance within Flash is a combobox, does it make any
// difference to the script?
$headers .= "Of: " . $_POST["ofCompany"] .">
";
$headers .= "Address: " . $_POST["Address"] .">
";
$headers .= "Post code: " . $_POST["postCode"] .">
";
$headers .= "Telephone: " . $_POST["telNumber"] .">
";
$headers .= "Fax: " . $_POST["faxNumber"] .">
";
$headers .= "Website: " . $_POST["web"] .">
";
$headers .= "Artwork supplied? " . $_POST["ArtworkSupplied"] .">
";
// this is another combobox.
$headers .= "Keep me informed: " . $_POST["infoRequest"] .">
";
// This is a checkbox
$message = $_POST["description"];
mail($sendTo, $subject, $message, $headers);
?>
This is a very simple Flash site with 2 forms. This is the larger of the two. The AS I have attached to the submit button reads as follows:
on (release) {
$envelope = new LoadVars();
function sendComments(){
$var1 = form.contact();
$var2 = form.ofCompany();
$var3 = form.Address();
$var4 = form.postCode();
$var5 = form.telNumber();
$var6 = form.faxNumber();
$var7 = form.emailAddress();
$var8 = form.web();
$var9 = form.replyBy();
$var10 = form.description();
$var11 = form.ArtworkSupplied();
$var12 = form.infoRequest();
$envelope.send("http://www.kiereen.com/estimate.php");
form.loadVariables("estimate.php", "POST");{
estimate = new LoadVars();
estimate.onLoad - function(success){
if (success) {
_root.gotoAndStop("thanks");
} else {
_root.gotoAndStop("error");
}
}
}
}
}
I have no way of knowing whether any of this works unless I upload it and trial it, which I am going to do in any event. I just need to know what the problems will be with the scripts supplied, if any. There are no syntax errors in the AS, but that doesn’t mean it’ll work though.