954,587 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Get variables from Action Script using PHP

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 = "";
   };
};
G_S
Junior Poster in Training
98 posts since Mar 2010
Reputation Points: 13
Solved Threads: 2
 


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 = "";
   };
};
farhan386
Light Poster
44 posts since Jul 2008
Reputation Points: 10
Solved Threads: 7
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You