Php mail picker help!

greetings, this is my first post.

Im tottally new at as, but i manage to make basic stuff out. So here’s my problem:

I manipulated a flash/php mail sender tutorial that i also found here, but cant make it work adding mails through lets say 5 checkboxes or more, the existing php form, has a prearranged mail contact so when executed, the mail form, send the mail_txt and the rest of the instances (from, subject, etc) to the indicated mail, but what i wanted was to add throguh checkboxes 5 or round 10 more mails so you can pick which person you have decided to send the mail in this time.

I know it shouldnt be much of a problem, but since im a total newbie, cant manage it at all, i have asked for help in a few more forums, but just get enough of superstars coders helping just to the pont where i cant really understand.

here’s the code of my fla

 
enviar = function () { 
   if (email_txt.text.length 
      && nombre_txt.length 
      && titulo_txt.length 
      && mensaje_txt.length) {if (email_txt.text.indexOf("@") != -1 
      && email_txt.text.indexOf(".") != -1) { 
      form_lv = new LoadVars(); 
      form_lv.sender = to.substring(0, to.length-1) 
         if(this["m"+i].selected) to +=this["m"+i].label+","; 
         for(var i=0; i<sender; i++) 
      form_lv.nombre = nombre_txt.text; 
      form_lv.mail = email_txt.text; 
      form_lv.mensaje = mensaje_txt.text; 
      form_lv.titulo = titulo_txt.text; 
      form_lv.sendAndLoad("[http://www.sindicatort.cl/send.php](http://www.sindicatort.cl/send.php)", form_lv, "POST"); 
      mensaje_txt.text = "Enviando Mensaje.."; 
      nombre_txt.text = ""; 
      email_txt.text = ""; 
      titulo_txt.text = ""; 
      form_lv.onLoad = function() {trace("LLEGO"); 
      if (this.estatus == "ok") 
      {mensaje_txt.text = "recibimos tu correo..."; 
      nombre_txt.text = ""; 
      email_txt.text = ""; 
      titulo_txt.text = "";} 
      else {mensaje_txt.text = "Problemas con el servidor\Intentalo de Nuevo";}};} 
      else {email_txt.text = "Correo Invalido";}} 
      else {email_txt.text = "Escribe tu correo"; 
      nombre_txt.text = "Escribe aca tu nombre"; 
      titulo_txt.text = "¿Asunto?"; 
      mensaje_txt.text = "escribe aca";}}; 
var to:String ="destinatario" 
var destinatario:Number = 8 
enviar_btn.onRelease = enviar; 
 
stop();

and here’s my php code:

<?php 
if(isset($_POST["nombre"]) && isset($_POST["titulo"]) && isset($_POST["mail"]) && isset($_POST["mensaje"]) ){ 
    $fecha = date("D-M-y H:i"); 
   $mymail = $_POST["destinatario"]; 
   $subject = "Desde la Web del Sindicato"; 
   $contenido = $_POST["nombre"]." Escribio :
"; 
   $contenido .= $_POST["mensaje"]."

"; 
   $contenido .= "Este mensaje fue escrito en la siguiente fecha:".$fecha; 
   $header = "From:".$_POST["mail"]."
Reply-To:".$_POST["mail"]."
"; 
   $header .= "X-Mailer:PHP/".phpversion()."
"; 
   $header .= "Mime-Version: 1.0
"; 
   $header .= "Content-Type: text/plain"; 
   mail($mymail, $subject, utf8_decode($contenido) ,$header); 
   echo "&estatus=ok&"; 
} 
?>

i know im supposed to add these lines of code somewhere in my fla, but i cant figure out where nor how:


var destinatarios:Number = 8 
var to:String ="" 
for(var i=0; i<destinatarios; i++){ 
  if(this["d"+i].selected) to +=this["d"+i].label+"," 
} 
LoadVars form_lv.destinatario = to.susbtring(0, to.length-1) 

if someone want to dl the source fla to understand what im talking about, in simple lines, want to add mails through checkboxes, the rest works perfectly (i mean, i can make it send a mail to a specific location through the php)

www.sindicatort.cl/phpandflamailsource.zip

thanks in advance.

ps: to see in action what im trying to do, check here www.sindicatort.cl/contacto.html

greetings from the end of the world