all groups > flash actionscript > march 2007 >
You're in the

flash actionscript

group:

Php email problems


Php email problems jak9942
3/31/2007 6:10:55 PM
flash actionscript:
I have created an online store and the cart has a counter that is used for an
order number. The user enters a name, email address and address and this is
sent to me via email. the problem is that the order number is being sent as
"undefined" the rest of the email is perfect.

The Code used in Flash and php are attached (The "count" is the counter text
in flash). Please help.



This is the code used in Flash:

function sendOrder(){
var error = ""
if(name.length<2) error +="Must fill your name\n"
if(email.text.indexOf("@")==-1) error +="Must enter a valid email\n"
if(tel.length<2) error +="Must fill your Address\n"
if(error!=""){
mx.controls.Alert.show(error, "Error", this, OK)
} else {
//create objects to send and receive data
myData = new LoadVars()
receive = new LoadVars()
myData.name = name.text
myData.email = email.text
myData.tel = tel.text
myData.details = _parent.str
myData.count = count.text
//Resets all textfields on this form
name.text = email.text = tel.text = _parent.step1.orderList.text = ""
myData.sendAndLoad("order.php", receive, "POST")
receive.onLoad = function(ok){
if(ok){
if(this.code=="ok") _parent._parent.moveForm(-300)
else mx.controls.Alert.show("There's some problem sending your data\nTry
again", "Error", this, OK)
} else mx.controls.Alert.show("There's some problem sending your data\nTry
again", "Error", this, OK)
}
}
}
send.onPress = function(){ sendOrder() }

And this is the code used in PHP:

<?php
$to = "jake.aston@gmail.com, ".$_POST['email'];
$date = date('l dS \of F Y h:i:s A');
$msg = "Order number:".$_POST['count']."\nName: ".$_POST['name']."\nAddress:
".$_POST['tel']."\nEmail: ".$_POST['email']."\nDetails:
".$_POST['details']."\nDate: $date";
mail($to, "Order", $msg);
echo "code=ok";


?>
Re: Php email problems abeall
4/1/2007 12:26:51 AM
Hey Jake,

Apparently the reference to "count.text" is not correct, or the count
TextField is blank(actually I think if it was blank it would come through as
blank, or "", so it must be an incorrect reference.)
AddThis Social Bookmark Button