Hi,


I need your help with a php issue here:


I have a flash form where the user enters some strings. Action Script is supposed to get these strings and place them into variables, then send the to php.

Now php gets these variables and places them inside other variables using $_POST, and then send them to my email.

The problem is that flash returns undefined every time the user clicks on submit.


My guess is that there is some sort of trouble in the communication between php and AS.


here is the php code (which I gues is the wrong one):

<?
$nombre=$_POST["nom"];
$ocupacion=$_POST["ocu"];
$nos_conoce=$_POST["conoc"];
$email=$_POST["ema"];

$para="aquipongomicorreo@gmail.com";
$asunto="envio de correo desde flash";

if (mail($para,$asunto,$ocupacion,$nombre)==true){
echo chr(38) . "resultado=ok";
}

and here is the AS code just in case:

boton.onRelease = function() {
   var correo = new LoadVars();
   correo.nom = nombre.text;
   correo.ocu = ocupacion.text;
   correo.conoc = nos_conoce.text;
   correo.ema = email.text;
   correo.sendAndLoad("correo.php",correo,"POST");
   correo.onLoad = function() {
      resultado.text = correo.res;
      nombre.text = "";
      ocupacion.text = "";
      nos_conoce.text = "";
      email.text = "";
   };
};

You must use two instances of LoadVars.

boton.onRelease = function() {
   var correo = new LoadVars();
//here
   var example = new LoadVars();

   correo.nom = nombre.text;
   correo.ocu = ocupacion.text;
   correo.conoc = nos_conoce.text;
   correo.ema = email.text;

//here
   correo.sendAndLoad("correo.php",example,"POST");
//and here
   example.onLoad = function(success:Boolean) {
      resultado.text = correo.res;
      nombre.text = "";
      ocupacion.text = "";
      nos_conoce.text = "";
      email.text = "";
   };
};
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.