Jump to content

Help Please Contact Code PHP & Flash dont work.


kkll70

Recommended Posts

I got a form on a website and when you fill it out you click send and it's suppose to send it to my email but it gives me error 'undefined'.

 

Feedback.php :

 

<?php

$to = '[email protected]';
$subject = 'Contact Form from Site';

$message = 'From: '.$_POST['from']."\n\n";
$message .= 'Subject: '.$_POST['subject']."\n\n";
$message .= 'Company: '.$_POST['company']."\n\n";
$message .= 'Phone: '.$_POST['phone']."\n\n";
$message .= 'Fax: '.$_POST['fax']."\n\n";
$message .= 'Address: '.$_POST['address']."\n\n";
$message .= 'City: '.$_POST['city']."\n\n";
$message .= 'State: '.$_POST['state']."\n\n";
$message .= 'Zip: '.$_POST['zip']."\n\n";
$message .= 'Email: '.$_POST['email']."\n\n";
$message .= 'Comments: '.$_POST['comments']."\n\n";

$additionalHeaders = "From: Feedback<[email protected]>\n";
$additionalHeaders .= "Reply-To: $_POST[email]";

$OK = mail($to, $subject, $message, $additionalHeaders);
if ($OK) {
echo 'sent=OK';
}
else {
echo 'sent=failed&reason='. urlencode('Theres seems to be a problem with the server. Please try later.')}
?>

 

 

My flash code :

 

function checkForm() :Boolean {

var missing:Boolean = false;

errorName_txt.text = errorCompany_txt.text = errorPhone_txt.text = errorFax_txt.text = errorAddress_txt.text = errorCity_txt.text = errorState_txt.text = errorZip_txt.text = errorSubject_txt.text = errorEmail_txt.text=errorComments_txt.text="";

if (name_txt.text == ""){
	errorName_txt.text = "*";
	missing = true;
}
if (company_txt.text == ""){
	errorCompany_txt.text = "*";
	missing = true;
}
if (phone_txt.text == ""){
	errorPhone_txt.text = "*";
	missing = true;
}
if (fax_txt.text == ""){
	errorFax_txt.text = "*";
	missing = true;
}
if (email_txt.text.indexOf("@") == -1) {
	errorEmail_txt.text = "*";
	missing = true;
}
if (address_txt.text == "") {
	errorAddress_txt.text = "*";
	missing = true;
}
if (city_txt.text == "") {
	errorCity_txt.text = "*";
	missing = true;
}
if (state_txt.text == "") {
	errorState_txt.text = "*";
	missing = true;
}
if (zip_txt.text == "") {
	errorState_txt.text = "*";
	missing = true;
}
if (subject_txt.text == "") {
	errorSubject_txt.text = "*";
	missing = true;
}
if (comments_txt.text == "") {
	errorComments_txt.text = "*";
	missing = true;
}

return missing ? false : true;
}
function sendMessage():Void {

var formOK:Boolean = checkForm();

if (formOK) {

	message.from = name_txt.text;
	message.subject = subject_txt.text
	message.company = company_txt.text;
	message.phone = phone_txt.text;
	message.fax = fax_txt.text;
	message.email = email_txt.text;

	message.address = address_txt.text;
	message.city = city_txt.text;
	message.state = state_txt.text;
	message.zip = zip_txt.text


	message.comments = comments_txt.text;
	message.sendAndLoad("feedback.php?ck="+ new Date().getTime(), messageSent);

	gotoAndStop("send");
}
}
function backToForm():Void {

gotoAndStop("Form");
}

var dateDisplay:TextFormat = new TextFormat();
dateDisplay.font = "Georgia,Times,_serif";
theDate_txt.setNewTextFormat(dateDisplay);
theDate_txt.autoSize = "left";

var getDate:LoadVars = new LoadVars();

var message:LoadVars = new LoadVars();
var messageSent:LoadVars = new LoadVars();

getDate.load("today2.php");

getDate.onLoad= function() {
theDate_txt.text = this.theDate;
};
messageSent.onLoad = function() {
if (this.sent == "OK") {
	gotoAndStop("confirmed");
} else {
	gotoAndStop("failed");
	failure_txt.text = this.reason;
}
};
gotoAndStop("Form");

<?php

$to = '[email protected]';
$subject = 'Contact Form from Site';

$message = 'From: '.$_POST['from']."\n\n";
$message .= 'Subject: '.$_POST['subject']."\n\n";
$message .= 'Company: '.$_POST['company']."\n\n";
$message .= 'Phone: '.$_POST['phone']."\n\n";
$message .= 'Fax: '.$_POST['fax']."\n\n";
$message .= 'Address: '.$_POST['address']."\n\n";
$message .= 'City: '.$_POST['city']."\n\n";
$message .= 'State: '.$_POST['state']."\n\n";
$message .= 'Zip: '.$_POST['zip']."\n\n";
$message .= 'Email: '.$_POST['email']."\n\n";
$message .= 'Comments: '.$_POST['comments']."\n\n";

$additionalHeaders = "From: Feedback<[email protected]>\n";
$additionalHeaders .= "Reply-To: $_POST[email]";

$OK = mail($to, $subject, $message, $additionalHeaders);
if ($OK) {
echo 'sent=OK';
}
else {
echo 'sent=failed&reason='. urlencode('Theres seems to be a problem with the server. Please try later.)}
?>

 

You were missing a single quote after your email address...

 

At least that was the first thing I saw

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.