Hello all,
If anyone could please help I am trying to create a complex contact form using UI2 components. I have a combo box, checkbox, some input fields, and a couple buttons. I have posted the actionscript below to see if anyone can find my issue. I am trying to send the variables to a PHP script I have called “email2.php” stored in my cgi-bin folder. Below is the Actionscript:
stop();
//COMBO BOX --------------------------------------------------------------
//default value - first setting from combo box
var defaultEmailPurpose = “general comment”;
trace (“You selected general comment.”);
//setting the selection differences
myComboBoxListener = new Object();
myComboBoxListener.change = function(eventObj) {
var emailPurpose = eventObj.target.selectedItem.label;
trace ( “You selected “+emailPurpose+”.”);
}
myComboBox.addEventListener (“change”, myComboBoxListener);
//CHECK BOX - send copy to me ----------------------------------------
myLabel.setStyle(“color”, 0x666666);
myCheckboxListener = new Object();
myCheckboxListener.click = function() {
if(myCheckbox.selected) {
myLabel.text = “You will receive a copy”;
var visitorCopy = email.text;
trace(“you will receive a copy”)
}else{
myLabel.text = “You will not receive a copy”;
trace(“you will not receive a copy”)
}
}
myCheckbox.addEventListener(“click”, myCheckboxListener);
//TEXT INPUT -------------------------------------------------------------
var visitorName = name.text;
var visitorEmail = email.text;
var visitorMessage = message.text;
//BUTTON EVENTS -----------------------------------------------------------
clearBtn.onRelease = function() {
name.text = “”;
email.text = “”;
message.text = “”;
status_text.text = “”;
}
sendBtn.onRelease = function() {
if(name.text == “” || email.text == “” || message.text == “” || email.text.indexOf("@") == -1 || email.text.indexOf(".") == -1 ) {
status_text.text = “It seems you made a mistake, please go back and correct any errors”;
}else{
status_text.text = “This may take a minute, please only click submit once”;
this.loadVariables(“http://www.jsdesignz.net/cgi-bin/email2.php”, “POST”);
}
}
next we have the PHP… please forgive the errors as this is my second try at PHP:
<?php
$sendTo = “jesse@jsdesignz.net” . $_POST[“visitorCopy”];
$subject = "JSDesignz.net form submission for " . $_POST[“defaultEmailPurpose”] . $_POST[“emailPurpose”];
$headers = "From: " . $_POST[“visitorName”] . “<” . $_POST[“visitorEmail”] . ">
";
$headers .= "Reply-To: " . $_POST[“visitorEmail”] . "
";
$headers .= "Return-Path: " . $_POST[“visitorEmail”];
$message = $_POST[“visitorMessage”];
mail($sendTo, $subject, $message, $headers);
?>
Can anyone help me out please… all help is greatly appreciated.
Thanks,
Jesse