Hi,
I am working on the contact form for a website that is done entirely in
flash. The following is the code I have for sending the variables to the
emailForm.php script that I created. The only problem I'm having is that
everytime you send the contact information, a new web browser window opens up
(it opens the php file in the web browser). I'm testing this on my local
server and it works great, except for the fact that everytime I send it, I dont
want a new browser window opening up.
function sendMessage():Void {
var formOK:Boolean = checkForm();
if (formOK) {
var message:LoadVars = new LoadVars();
message.firstname = contactForm.firstName_txt.text;
message.lastname = contactForm.lastName_txt.text;
message.address = contactForm.address_txt.text;
message.city = contactForm.city_txt.text;
message.state = contactForm.state_cmb.selectedItem.label;
message.email = contactForm.email_txt.text;
message.phonenumber = contactForm.phoneNumber_txt.text;
message.message = contactForm.message_txt.text;
message.send("http://localhost/robertweisscpa/emailForm.php", "POST");
import mx.controls.Alert;
var oListener:Object = new Object();
oListener.click = function():Void {
gotoAndStop(1);
};
Alert.show("Your contact information has been sent", null, Alert.OK, null,
oListener);
}
};
contactForm.send_btn.onRelease = sendMessage;
<?php
$to = "pilot329@msn.com";
$subject = "robertweisscpa.com Contact Submission From ".$_POST['firstname']."
".$_POST['lastname'];
$message = 'Below is information from someone trying to contact you via your
website, robertweisscpa.com'."\n\n";
$message .= 'From: '.$_POST['firstname']." ".$_POST['lastname']."\n\n";
$message .= 'Address: '.$_POST['address']."\n\n";
$message .= 'City: '.$_POST['city']."\n\n";
$message .= 'State: '.$_POST['state']."\n\n";
$message .= 'E-Mail: '.$_POST['email']."\n\n";
$message .= 'Phone Number: '.$_POST['phonenumber']."\n\n";
$message .= 'Message: '.$_POST['message'];
mail($to, $subject, $message);
?>
MotionMaker - 22 Jan 2007 12:37 GMT
Be sure there is no space outside the PHP tags. That includes the space bar, tabs and returns.